forked from ScoDoc/DocScoDoc
fix plantage si un seul groupe ; correction indentation for radio button in wtf_forms (css)
This commit is contained in:
parent
13c027fc19
commit
a5ed9b815f
@ -89,6 +89,9 @@ def _get_group_info(evaluation_id):
|
|||||||
if partition != TOUS:
|
if partition != TOUS:
|
||||||
has_groups = True
|
has_groups = True
|
||||||
nb_groups = len(groups_tree)
|
nb_groups = len(groups_tree)
|
||||||
|
else:
|
||||||
|
has_groups = False
|
||||||
|
nb_groups = 1
|
||||||
return groups_tree, has_groups, nb_groups
|
return groups_tree, has_groups, nb_groups
|
||||||
|
|
||||||
|
|
||||||
@ -121,9 +124,7 @@ class PlacementForm(FlaskForm):
|
|||||||
)
|
)
|
||||||
groups = SelectMultipleField(
|
groups = SelectMultipleField(
|
||||||
"Groupe(s)",
|
"Groupe(s)",
|
||||||
validators=[
|
validators=[],
|
||||||
wtforms.validators.DataRequired("indiquez au moins un groupe"),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
submit = SubmitField("OK")
|
submit = SubmitField("OK")
|
||||||
|
|
||||||
@ -131,8 +132,8 @@ class PlacementForm(FlaskForm):
|
|||||||
super().__init__(formdata=formdata, data=data)
|
super().__init__(formdata=formdata, data=data)
|
||||||
self.groups_tree = {}
|
self.groups_tree = {}
|
||||||
self.has_groups = None
|
self.has_groups = None
|
||||||
self.group_tree_length = None
|
|
||||||
self.nb_groups = None
|
self.nb_groups = None
|
||||||
|
self.tous_id = None
|
||||||
self.set_evaluation_infos(data["evaluation_id"])
|
self.set_evaluation_infos(data["evaluation_id"])
|
||||||
|
|
||||||
def set_evaluation_infos(self, evaluation_id):
|
def set_evaluation_infos(self, evaluation_id):
|
||||||
@ -143,13 +144,20 @@ class PlacementForm(FlaskForm):
|
|||||||
self.groups_tree, self.has_groups, self.nb_groups = _get_group_info(
|
self.groups_tree, self.has_groups, self.nb_groups = _get_group_info(
|
||||||
evaluation_id
|
evaluation_id
|
||||||
)
|
)
|
||||||
if self.has_groups:
|
|
||||||
choices = []
|
choices = []
|
||||||
for partition in self.groups_tree:
|
for partition in self.groups_tree:
|
||||||
for groupe in self.groups_tree[partition]:
|
for groupe in self.groups_tree[partition]:
|
||||||
|
if (
|
||||||
|
groupe == TOUS
|
||||||
|
): # Affichage et valeur spécifique pour le groupe TOUS
|
||||||
|
self.tous_id = str(self.groups_tree[partition][groupe])
|
||||||
|
choices.append((TOUS, TOUS))
|
||||||
|
else:
|
||||||
groupe_id = str(self.groups_tree[partition][groupe])
|
groupe_id = str(self.groups_tree[partition][groupe])
|
||||||
choices.append((groupe_id, "%s (%s)" % (str(groupe), partition)))
|
choices.append((groupe_id, "%s (%s)" % (str(groupe), partition)))
|
||||||
self.groups.choices = choices
|
self.groups.choices = choices
|
||||||
|
# self.groups.default = [TOUS] # Ne fonctionnne pas... (ni dans la déclaration de PlaceForm.groups)
|
||||||
|
# la réponse [] est de toute façon transposée en [ self.tous_id ] lors du traitement (cas du groupe unique)
|
||||||
|
|
||||||
|
|
||||||
class _DistributeurContinu:
|
class _DistributeurContinu:
|
||||||
@ -201,7 +209,6 @@ def placement_eval_selectetuds(evaluation_id):
|
|||||||
% runner.__dict__
|
% runner.__dict__
|
||||||
)
|
)
|
||||||
return runner.exec_placement() # calcul et generation du fichier
|
return runner.exec_placement() # calcul et generation du fichier
|
||||||
# return flask.redirect(url_for("scodoc.index"))
|
|
||||||
htmls = [
|
htmls = [
|
||||||
html_sco_header.sco_header(init_jquery_ui=True),
|
html_sco_header.sco_header(init_jquery_ui=True),
|
||||||
sco_evaluations.evaluation_describe(evaluation_id=evaluation_id),
|
sco_evaluations.evaluation_describe(evaluation_id=evaluation_id),
|
||||||
@ -224,7 +231,12 @@ class PlacementRunner:
|
|||||||
self.salle = form["salle"].data
|
self.salle = form["salle"].data
|
||||||
self.nb_rangs = form["nb_rangs"].data
|
self.nb_rangs = form["nb_rangs"].data
|
||||||
self.file_format = form["file_format"].data
|
self.file_format = form["file_format"].data
|
||||||
self.groups_ids = form["groups"].data
|
if len(form["groups"].data) == 0:
|
||||||
|
self.groups_ids = [form.tous_id]
|
||||||
|
else: # On remplace le mot-clé TOUS le l'identiant de ce groupe
|
||||||
|
self.groups_ids = [
|
||||||
|
gid if gid != TOUS else form.tous_id for gid in form["groups"].data
|
||||||
|
]
|
||||||
self.eval_data = sco_evaluations.do_evaluation_list(
|
self.eval_data = sco_evaluations.do_evaluation_list(
|
||||||
{"evaluation_id": self.evaluation_id}
|
{"evaluation_id": self.evaluation_id}
|
||||||
)[0]
|
)[0]
|
||||||
|
@ -1094,6 +1094,8 @@ h2.formsemestre, .gtrcontent h2 {
|
|||||||
}
|
}
|
||||||
.wtf-field li {
|
.wtf-field li {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
}.wtf-field ul {
|
||||||
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
.wtf-field .errors {
|
.wtf-field .errors {
|
||||||
color: red ; font-weight: bold;
|
color: red ; font-weight: bold;
|
||||||
|
Loading…
Reference in New Issue
Block a user