forked from ScoDoc/ScoDoc
minor refactor
This commit is contained in:
parent
b3225e07f7
commit
5f6c434497
@ -30,57 +30,50 @@
|
||||
Contribution M. Salomon, UFC / IUT DE BELFORT-MONTBÉLIARD, 2016
|
||||
|
||||
"""
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
import random
|
||||
import time
|
||||
from copy import copy
|
||||
|
||||
import wtforms.validators
|
||||
from flask import request, render_template, url_for
|
||||
from flask import request, render_template
|
||||
from flask_login import current_user
|
||||
from werkzeug import Response
|
||||
from flask_wtf import FlaskForm
|
||||
from openpyxl.styles import PatternFill, Alignment, Border, Side, Font
|
||||
from wtforms import (
|
||||
StringField,
|
||||
PasswordField,
|
||||
BooleanField,
|
||||
SubmitField,
|
||||
SelectField,
|
||||
RadioField,
|
||||
HiddenField,
|
||||
SelectMultipleField,
|
||||
validators,
|
||||
)
|
||||
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
|
||||
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app.scodoc import html_sco_header
|
||||
from app import ScoValueError
|
||||
from app.scodoc import html_sco_header, sco_preferences
|
||||
from app.scodoc import sco_edit_module
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_excel
|
||||
from app.scodoc.sco_excel import ScoExcelBook, COLORS
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_formsemestre_inscriptions
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_moduleimpl
|
||||
from app.scodoc import sco_permissions_check
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_saisie_notes
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc import sco_etud
|
||||
import sco_version
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.sco_excel import * # XXX à vérifier
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
|
||||
_ = lambda x: x # sans babel
|
||||
_l = _
|
||||
# _ = lambda x: x # sans babel
|
||||
# _l = _
|
||||
|
||||
COORD = "Coordonnées"
|
||||
SEQ = "Continue"
|
||||
|
||||
|
||||
class PlacementForm(FlaskForm):
|
||||
"""Formulaire pour placement des étudiants en Salle"""
|
||||
|
||||
TOUS = "Tous"
|
||||
evaluation_id = HiddenField("evaluation_id")
|
||||
file_format = RadioField(
|
||||
@ -115,7 +108,6 @@ class PlacementForm(FlaskForm):
|
||||
eval_data = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not eval_data:
|
||||
raise ScoValueError("invalid evaluation_id")
|
||||
eval_data = eval_data[0]
|
||||
# groupes
|
||||
groups = sco_groups.do_evaluation_listegroupes(
|
||||
evaluation_id, include_default=True
|
||||
@ -123,7 +115,7 @@ class PlacementForm(FlaskForm):
|
||||
self.groups_tree = {}
|
||||
self.has_groups = False
|
||||
for group in groups:
|
||||
partition = group["partition_name"] or self.TOUS # TODO check required
|
||||
partition = group["partition_name"] or self.TOUS
|
||||
group_id = group["group_id"]
|
||||
group_name = group["group_name"] or self.TOUS
|
||||
if partition not in self.groups_tree:
|
||||
@ -190,10 +182,12 @@ def placement_eval_selectetuds(evaluation_id):
|
||||
)
|
||||
return runner.exec_placement() # calcul et generation du fichier
|
||||
# return flask.redirect(url_for("scodoc.index"))
|
||||
H = [html_sco_header.sco_header(init_jquery_ui=True)]
|
||||
H.append(sco_evaluations.evaluation_describe(evaluation_id=evaluation_id))
|
||||
H.append("<h3>Placement et émargement des étudiants</h3>")
|
||||
H.append(render_template("scodoc/forms/placement.html", form=form))
|
||||
H = [
|
||||
html_sco_header.sco_header(init_jquery_ui=True),
|
||||
sco_evaluations.evaluation_describe(evaluation_id=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(H) + "<p>" + F
|
||||
|
||||
@ -269,7 +263,6 @@ class PlacementRunner:
|
||||
def _build_listetud(self):
|
||||
if None in [g["group_name"] for g in self.groups]: # tous les etudiants
|
||||
getallstudents = True
|
||||
gr_title_filename = "tous"
|
||||
else:
|
||||
getallstudents = False
|
||||
etudids = sco_groups.do_evaluation_listeetuds_groups(
|
||||
@ -330,7 +323,6 @@ class PlacementRunner:
|
||||
"ligne": "Ligne",
|
||||
"place": "Place",
|
||||
}
|
||||
nb_rangs = int(self.nb_rangs)
|
||||
if self.etiquetage == COORD:
|
||||
columns_ids = ["nom", "prenom", "colonne", "ligne"]
|
||||
else:
|
||||
@ -531,7 +523,7 @@ class PlacementRunner:
|
||||
ws0.append_row(cells_c)
|
||||
ws0.set_row_dimension_height(row, space / 25)
|
||||
|
||||
def _next_page(ws):
|
||||
def _next_page(self, ws):
|
||||
pass
|
||||
|
||||
def _feuille1(self, ws, maxlines):
|
||||
|
Loading…
Reference in New Issue
Block a user