diff --git a/app/scodoc/sco_placement.py b/app/scodoc/sco_placement.py index 500c5a98..32f89437 100644 --- a/app/scodoc/sco_placement.py +++ b/app/scodoc/sco_placement.py @@ -144,7 +144,7 @@ class PlacementForm(FlaskForm): class _DistributeurContinu: """Distribue les places selon un ordre numérique.""" - def __init(self): + def __init__(self): self.position = 1 def suivant(self): @@ -193,7 +193,7 @@ def placement_eval_selectetuds(evaluation_id): H = [html_sco_header.sco_header(init_jquery_ui=True)] H.append(sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)) H.append("
" + F @@ -493,36 +493,40 @@ class PlacementRunner: # etudiants - feuille0 place = 1 - for rang, linetud in enumerate(self.plan, start=1): - # Chaque rang est affiché sur 3 lignes xlsx (notées A, B, C) - # ligne A: le nom, ligne B: le prénom, ligne C: un espace ou la place - cells_a = [ws0.make_cell(rang, self.styles["2b"])] - cells_b = [ws0.make_cell("", self.styles["2b"])] - cells_c = [ws0.make_cell("", self.styles["2b"])] - row = 14 # premieère ligne de signature - for etudid in linetud: - cells_a.append(ws0.make_cell(etudid[0], self.styles["1t"])) - cells_b.append(ws0.make_cell(etudid[1], self.styles["1m"])) - if self.etiquetage == COORD: - cell_c = ws0.make_cell("", self.styles["1bb"]) - else: - cell_c = ws0.make_cell("place %s" % place, self.styles["1bb"]) - cells_c.append(cell_c) - ws0.set_row_dimension_height(row, space / 25) - row += 3 + col = 0 + rang = 1 + # Chaque rang est affiché sur 3 lignes xlsx (notées A, B, C) + # ligne A: le nom, ligne B: le prénom, ligne C: un espace ou la place + cells_a = [ws0.make_cell(rang, self.styles["2b"])] + cells_b = [ws0.make_cell("", self.styles["2b"])] + cells_c = [ws0.make_cell("", self.styles["2b"])] + row = 13 # première ligne de signature + for linetud in self.plan: + cells_a.append(ws0.make_cell(linetud[0][0], self.styles["1t"])) # nom + cells_b.append(ws0.make_cell(linetud[0][1], self.styles["1m"])) # prenom + if self.etiquetage == COORD: + cell_c = ws0.make_cell("", self.styles["1bb"]) + else: + cell_c = ws0.make_cell("place %s" % place, self.styles["1bb"]) place = place + 1 - if col == self.nb_rangs: - ws0.append_row(cells_a) - ws0.append_row(cells_b) - ws0.append_row(cells_c) - cells_a = [ws0.make_cell(rang, self.styles["2b"])] - cells_b = [ws0.make_cell("", self.styles["2b"])] - cells_c = [ws0.make_cell("", self.styles["2b"])] - # publication du rang final incomplet - ws0.append_row(cells_a) - ws0.append_row(cells_b) - ws0.append_row(cells_c) + cells_c.append(cell_c) ws0.set_row_dimension_height(row, space / 25) + row += 3 + col += 1 + if col == self.nb_rangs: # On a fini la rangée courante + ws0.append_row(cells_a) # on affiche les 3 lignes construites + ws0.append_row(cells_b) + ws0.append_row(cells_c) + cells_a = [ws0.make_cell(rang, self.styles["2b"])] # on réinitialise les 3 lignes + cells_b = [ws0.make_cell("", self.styles["2b"])] + cells_c = [ws0.make_cell("", self.styles["2b"])] + col = 0 + rang += 1 + # publication du rang final incomplet + ws0.append_row(cells_a) # Affiche des 3 lignes (dernières lignes incomplètes) + ws0.append_row(cells_b) + ws0.append_row(cells_c) + ws0.set_row_dimension_height(row, space / 25) def _next_page(ws): pass @@ -553,15 +557,15 @@ class PlacementRunner: lines = self._init_lines(maxlines) line = 0 col = 0 - for etud in sorted(self.plan, key=lambda etud: etud[0][0]): + for etud in sorted(self.plan, key=lambda e: e[0][0]): # tri alphabétique # check for skip of list or page if col > 0: # add a empty cell between lists lines[line].append(ws.make_cell()) lines[line].append(ws.make_cell(etud[0][0], self.styles["2l"])) lines[line].append(ws.make_cell(etud[0][1], self.styles["2m1"])) if self.etiquetage == COORD: - lines[line].append(ws.make_cell(etud[1][0], self.styles["2m2"])) - lines[line].append(ws.make_cell(etud[1][1], self.styles["2r"])) + lines[line].append(ws.make_cell(etud[1][1], self.styles["2m2"])) + lines[line].append(ws.make_cell(etud[1][0], self.styles["2r"])) else: lines[line].append(ws.make_cell(etud[1], self.styles["2r"])) line = line + 1 @@ -586,7 +590,6 @@ class PlacementRunner: lines: liste de tuples (etudid, nom, prenom, etat, groupe, val, explanation) """ - breakpoint() sem_preferences = sco_preferences.SemPreferences() space = sem_preferences.get("feuille_placement_emargement") maxlines = sem_preferences.get("feuille_placement_positions") diff --git a/app/templates/forms/placement.html b/app/templates/scodoc/forms/placement.html similarity index 92% rename from app/templates/forms/placement.html rename to app/templates/scodoc/forms/placement.html index 1c5ca544..7f169cd3 100644 --- a/app/templates/forms/placement.html +++ b/app/templates/scodoc/forms/placement.html @@ -28,7 +28,7 @@ {{ render_field(form.etiquetage) }} {% if form.has_groups %} {{ render_field(form.groups) }} -