forked from ScoDoc/ScoDoc
pylint corrections
This commit is contained in:
parent
44117fb0e2
commit
b03eee12a1
@ -189,11 +189,12 @@ def placement_eval_selectetuds(evaluation_id):
|
||||
"<h3>Placement et émargement des étudiants</h3>",
|
||||
render_template("scodoc/forms/placement.html", form=form),
|
||||
]
|
||||
F = html_sco_header.sco_footer()
|
||||
return "\n".join(htmls) + "<p>" + F
|
||||
footer = html_sco_header.sco_footer()
|
||||
return "\n".join(htmls) + "<p>" + footer
|
||||
|
||||
|
||||
class PlacementRunner:
|
||||
"""Execution de l'action définie par le formulaire"""
|
||||
def __init__(self, form):
|
||||
"""Calcul et génération du fichier sur la base des données du formulaire"""
|
||||
self.evaluation_id = form["evaluation_id"].data
|
||||
@ -216,14 +217,14 @@ class PlacementRunner:
|
||||
self.moduleimpl_data = sco_moduleimpl.do_moduleimpl_list(
|
||||
moduleimpl_id=self.moduleimpl_id
|
||||
)[0]
|
||||
self.Mod = sco_edit_module.do_module_list(
|
||||
self.module_data = sco_edit_module.do_module_list(
|
||||
args={"module_id": self.moduleimpl_data["module_id"]}
|
||||
)[0]
|
||||
self.sem = sco_formsemestre.get_formsemestre(
|
||||
self.moduleimpl_data["formsemestre_id"]
|
||||
)
|
||||
self.evalname = "%s-%s" % (
|
||||
self.Mod["code"],
|
||||
self.module_data["code"],
|
||||
ndb.DateDMYtoISO(self.eval_data["jour"]),
|
||||
)
|
||||
if self.eval_data["description"]:
|
||||
@ -232,7 +233,7 @@ class PlacementRunner:
|
||||
self.evaltitre = "évaluation du %s" % self.eval_data["jour"]
|
||||
self.desceval = [ # une liste de chaines: description de l'evaluation
|
||||
"%s" % self.sem["titreannee"],
|
||||
"Module : %s - %s" % (self.Mod["code"], self.Mod["abbrev"]),
|
||||
"Module : %s - %s" % (self.module_data["code"], self.module_data["abbrev"]),
|
||||
"Surveillants : %s" % self.surveillants,
|
||||
"Batiment : %(batiment)s - Salle : %(salle)s" % self.__dict__,
|
||||
"Controle : %s (coef. %g)"
|
||||
@ -240,6 +241,7 @@ class PlacementRunner:
|
||||
]
|
||||
|
||||
def check_placement(self):
|
||||
"""Vérifie que l'utilisateur courant a le droit d'édition sur les notes"""
|
||||
# Check access (admin, respformation, and responsable_id)
|
||||
return sco_permissions_check.can_edit_notes(
|
||||
self.current_user, self.moduleimpl_id
|
||||
@ -249,8 +251,7 @@ class PlacementRunner:
|
||||
self._repartition()
|
||||
if self.file_format == "xls":
|
||||
return self._production_xls()
|
||||
else:
|
||||
return self._production_pdf()
|
||||
return self._production_pdf()
|
||||
|
||||
def _repartition(self):
|
||||
"""
|
||||
@ -356,8 +357,7 @@ class PlacementRunner:
|
||||
self.moduleimpl_data["formsemestre_id"]
|
||||
),
|
||||
)
|
||||
t = tab.make_page(format="pdf", with_html_headers=False)
|
||||
return t
|
||||
return tab.make_page(format="pdf", with_html_headers=False)
|
||||
|
||||
def _one_header(self, ws):
|
||||
cells = [
|
||||
@ -453,16 +453,16 @@ class PlacementRunner:
|
||||
),
|
||||
}
|
||||
|
||||
def _titres(self, ws):
|
||||
dt = time.strftime("%d/%m/%Y a %Hh%M")
|
||||
ws.append_single_cell_row(
|
||||
"Feuille placement etudiants éditée le %s" % dt, self.styles["titres"]
|
||||
def _titres(self, worksheet):
|
||||
datetime = time.strftime("%d/%m/%Y a %Hh%M")
|
||||
worksheet.append_single_cell_row(
|
||||
"Feuille placement etudiants éditée le %s" % datetime, self.styles["titres"]
|
||||
)
|
||||
for line, desceval in enumerate(self.desceval):
|
||||
if line in [1, 4, 7]:
|
||||
ws.append_blank_row()
|
||||
ws.append_single_cell_row(desceval, self.styles["titres"])
|
||||
ws.append_single_cell_row(
|
||||
worksheet.append_blank_row()
|
||||
worksheet.append_single_cell_row(desceval, self.styles["titres"])
|
||||
worksheet.append_single_cell_row(
|
||||
"Date : %(jour)s - Horaire : %(heure_debut)s à %(heure_fin)s"
|
||||
% self.eval_data,
|
||||
self.styles["titres"],
|
||||
@ -515,9 +515,6 @@ class PlacementRunner:
|
||||
ws0.append_row(cells_c)
|
||||
ws0.set_row_dimension_height(row, space / 25)
|
||||
|
||||
def _next_page(self, ws):
|
||||
pass
|
||||
|
||||
def _feuille1(self, ws, maxlines):
|
||||
# etudiants - feuille1
|
||||
# structuration:
|
||||
@ -587,10 +584,10 @@ class PlacementRunner:
|
||||
1 / 250
|
||||
) # changement d unités entre pyExcelerator et openpyxl
|
||||
|
||||
wb = ScoExcelBook()
|
||||
workbook = ScoExcelBook()
|
||||
|
||||
SheetName0 = "Emargement"
|
||||
ws0 = wb.create_sheet(SheetName0)
|
||||
ws0 = workbook.create_sheet(SheetName0)
|
||||
# ajuste largeurs colonnes (unite inconnue, empirique)
|
||||
width = 4500 * column_width_ratio
|
||||
if nb_rangs > 5:
|
||||
@ -603,9 +600,9 @@ class PlacementRunner:
|
||||
)
|
||||
|
||||
SheetName1 = "Positions"
|
||||
ws1 = wb.create_sheet(SheetName1)
|
||||
ws1 = workbook.create_sheet(SheetName1)
|
||||
|
||||
self._make_styles(ws0, ws1)
|
||||
self._feuille0(ws0, space)
|
||||
self._feuille1(ws1, maxlines)
|
||||
return wb.generate()
|
||||
return workbook.generate()
|
||||
|
Loading…
Reference in New Issue
Block a user