listenotes ok

This commit is contained in:
Emmanuel Viennet 2021-08-11 14:00:39 +02:00
parent c3eb401fe1
commit ad4b5a135e
6 changed files with 34 additions and 20 deletions

View File

@ -634,7 +634,7 @@ def make_etud_args(etudid=None, code_nip=None, REQUEST=None, raise_exc=True):
args = {"code_nip": code_nip}
elif REQUEST:
if "etudid" in REQUEST.form:
args = {"etudid": REQUEST.form["etudid"]}
args = {"etudid": int(REQUEST.form["etudid"])}
elif "code_nip" in REQUEST.form:
args = {"code_nip": REQUEST.form["code_nip"]}
elif "code_ine" in REQUEST.form:

View File

@ -135,7 +135,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"Form choix modules / responsables et creation formsemestre"
# Fonction accessible à tous, controle acces à la main:
if edit:
formsemestre_id = REQUEST.form["formsemestre_id"]
formsemestre_id = int(REQUEST.form["formsemestre_id"])
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if not current_user.has_permission(Permission.ScoImplement):
if not edit:
@ -154,14 +154,14 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
uid2display[u.id] = u.get_nomplogin()
allowed_user_names = list(uid2display.values()) + [""]
#
formation_id = REQUEST.form["formation_id"]
formation_id = int(REQUEST.form["formation_id"])
F = sco_formations.formation_list(context, args={"formation_id": formation_id})
if not F:
raise ScoValueError("Formation inexistante !")
F = F[0]
if not edit:
initvalues = {"titre": _default_sem_title(F)}
semestre_id = REQUEST.form["semestre_id"]
semestre_id = int(REQUEST.form["semestre_id"])
sem_module_ids = set()
else:
# setup form init values

View File

@ -1418,7 +1418,10 @@ def do_evaluation_listeetuds_groups(
if not groups:
return [] # no groups, so no students
rg = ["gm.group_id = '%(group_id)s'" % g for g in groups]
rq = "and Isem.etudid = gm.etudid and gd.partition_id = p.partition_id and p.formsemestre_id = Isem.formsemestre_id"
rq = """and Isem.etudid = gm.etudid
and gd.partition_id = p.id
and p.formsemestre_id = Isem.formsemestre_id
"""
r = rq + " AND (" + " or ".join(rg) + " )"
fromtables += ["group_membership gm", "group_descr gd", "partition p"]
else:
@ -1458,7 +1461,15 @@ def do_evaluation_listegroupes(context, evaluation_id, include_default=False):
cnx = ndb.GetDBConnexion()
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
cursor.execute(
"SELECT DISTINCT gd.group_id FROM group_descr gd, group_membership gm, partition p, notes_moduleimpl m, notes_evaluation e WHERE gm.group_id = gd.group_id and gd.partition_id = p.partition_id and p.formsemestre_id = m.formsemestre_id and m.moduleimpl_id = e.moduleimpl_id and e.evaluation_id = %(evaluation_id)s"
"""SELECT DISTINCT gd.id AS group_id
FROM group_descr gd, group_membership gm, partition p,
notes_moduleimpl m, notes_evaluation e
WHERE gm.group_id = gd.id
and gd.partition_id = p.id
and p.formsemestre_id = m.formsemestre_id
and m.id = e.moduleimpl_id
and e.id = %(evaluation_id)s
"""
+ c,
{"evaluation_id": evaluation_id},
)
@ -1473,7 +1484,7 @@ def listgroups(context, group_ids):
groups = []
for group_id in group_ids:
cursor.execute(
"""SELECT gd.*, p.*
"""SELECT gd.id AS group_id, gd.*, p.id AS partition_id, p.*
FROM group_descr gd, partition p
WHERE p.id = gd.partition_id
AND gd.id = %(group_id)s

View File

@ -59,15 +59,16 @@ def do_evaluation_listenotes(context, REQUEST):
"""
Affichage des notes d'une évaluation
args: evaluation_id
args: evaluation_id ou moduleimpl_id
(si moduleimpl_id, affiche toutes les évaluatons du module)
"""
mode = None
if "evaluation_id" in REQUEST.form:
evaluation_id = REQUEST.form["evaluation_id"]
evaluation_id = int(REQUEST.form["evaluation_id"])
mode = "eval"
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
if "moduleimpl_id" in REQUEST.form:
moduleimpl_id = REQUEST.form["moduleimpl_id"]
moduleimpl_id = int(REQUEST.form["moduleimpl_id"])
mode = "module"
evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
if not mode:
@ -428,7 +429,7 @@ def _make_table_notes(
columns_ids.append("comment")
# titres divers:
gl = "".join(["&group_ids%3Alist=" + g for g in group_ids])
gl = "".join(["&group_ids%3Alist=" + str(g) for g in group_ids])
if note_sur_20:
gl = "&note_sur_20%3Alist=yes" + gl
if anonymous_listing:
@ -583,7 +584,7 @@ def _add_eval_columns(
val = None
if val is None:
row["_" + evaluation_id + "_td_attrs"] = 'class="etudabs" '
row["_" + str(evaluation_id) + "_td_attrs"] = 'class="etudabs" '
if not row.get("_css_row_class", ""):
row["_css_row_class"] = "etudabs"
# regroupe les commentaires
@ -599,7 +600,7 @@ def _add_eval_columns(
row.update(
{
evaluation_id: val_fmt,
"_" + evaluation_id + "_help": explanation,
"_" + str(evaluation_id) + "_help": explanation,
# si plusieurs evals seront ecrasés et non affichés:
"comment": explanation,
"expl_key": expl_key,
@ -619,7 +620,9 @@ def _add_eval_columns(
if nb_notes > 0:
moys[evaluation_id] = "%.3g" % (sum_notes / nb_notes)
moys["_" + evaluation_id + "_help"] = "moyenne sur %d notes (%s le %s)" % (
moys[
"_" + str(evaluation_id) + "_help"
] = "moyenne sur %d notes (%s le %s)" % (
nb_notes,
e["description"],
e["jour"],
@ -630,11 +633,11 @@ def _add_eval_columns(
titles[evaluation_id] = "%(description)s (%(jour)s)" % e
if e["eval_state"]["evalcomplete"]:
titles["_" + evaluation_id + "_td_attrs"] = 'class="eval_complete"'
titles["_" + str(evaluation_id) + "_td_attrs"] = 'class="eval_complete"'
elif e["eval_state"]["evalattente"]:
titles["_" + evaluation_id + "_td_attrs"] = 'class="eval_attente"'
titles["_" + str(evaluation_id) + "_td_attrs"] = 'class="eval_attente"'
else:
titles["_" + evaluation_id + "_td_attrs"] = 'class="eval_incomplete"'
titles["_" + str(evaluation_id) + "_td_attrs"] = 'class="eval_incomplete"'
return notes, nb_abs, nb_att # pour histogramme

View File

@ -60,7 +60,7 @@ def do_placement_selectetuds(context, REQUEST):
"""
Choisi les étudiants et les infos sur la salle pour leur placement.
"""
evaluation_id = REQUEST.form["evaluation_id"]
evaluation_id = int(REQUEST.form["evaluation_id"])
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
if not E:
raise ScoValueError("invalid evaluation_id")
@ -241,7 +241,7 @@ def do_placement(context, REQUEST):
authuser = REQUEST.AUTHENTICATED_USER
authusername = str(authuser)
try:
evaluation_id = REQUEST.form["evaluation_id"]
evaluation_id = int(REQUEST.form["evaluation_id"])
except:
raise ScoValueError(
"Formulaire incomplet ! Vous avez sans doute attendu trop longtemps, veuillez vous reconnecter. Si le problème persiste, contacter l'administrateur. Merci."

View File

@ -168,7 +168,7 @@ def do_evaluation_upload_xls(context, REQUEST):
Soumission d'un fichier XLS (evaluation_id, notefile)
"""
authuser = REQUEST.AUTHENTICATED_USER
evaluation_id = REQUEST.form["evaluation_id"]
evaluation_id = int(REQUEST.form["evaluation_id"])
comment = REQUEST.form["comment"]
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_withmodule_list(