forked from ScoDoc/ScoDoc
listenotes ok
This commit is contained in:
parent
c3eb401fe1
commit
ad4b5a135e
@ -634,7 +634,7 @@ def make_etud_args(etudid=None, code_nip=None, REQUEST=None, raise_exc=True):
|
|||||||
args = {"code_nip": code_nip}
|
args = {"code_nip": code_nip}
|
||||||
elif REQUEST:
|
elif REQUEST:
|
||||||
if "etudid" in REQUEST.form:
|
if "etudid" in REQUEST.form:
|
||||||
args = {"etudid": REQUEST.form["etudid"]}
|
args = {"etudid": int(REQUEST.form["etudid"])}
|
||||||
elif "code_nip" in REQUEST.form:
|
elif "code_nip" in REQUEST.form:
|
||||||
args = {"code_nip": REQUEST.form["code_nip"]}
|
args = {"code_nip": REQUEST.form["code_nip"]}
|
||||||
elif "code_ine" in REQUEST.form:
|
elif "code_ine" in REQUEST.form:
|
||||||
|
@ -135,7 +135,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
"Form choix modules / responsables et creation formsemestre"
|
"Form choix modules / responsables et creation formsemestre"
|
||||||
# Fonction accessible à tous, controle acces à la main:
|
# Fonction accessible à tous, controle acces à la main:
|
||||||
if edit:
|
if edit:
|
||||||
formsemestre_id = REQUEST.form["formsemestre_id"]
|
formsemestre_id = int(REQUEST.form["formsemestre_id"])
|
||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
if not current_user.has_permission(Permission.ScoImplement):
|
if not current_user.has_permission(Permission.ScoImplement):
|
||||||
if not edit:
|
if not edit:
|
||||||
@ -154,14 +154,14 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
uid2display[u.id] = u.get_nomplogin()
|
uid2display[u.id] = u.get_nomplogin()
|
||||||
allowed_user_names = list(uid2display.values()) + [""]
|
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})
|
F = sco_formations.formation_list(context, args={"formation_id": formation_id})
|
||||||
if not F:
|
if not F:
|
||||||
raise ScoValueError("Formation inexistante !")
|
raise ScoValueError("Formation inexistante !")
|
||||||
F = F[0]
|
F = F[0]
|
||||||
if not edit:
|
if not edit:
|
||||||
initvalues = {"titre": _default_sem_title(F)}
|
initvalues = {"titre": _default_sem_title(F)}
|
||||||
semestre_id = REQUEST.form["semestre_id"]
|
semestre_id = int(REQUEST.form["semestre_id"])
|
||||||
sem_module_ids = set()
|
sem_module_ids = set()
|
||||||
else:
|
else:
|
||||||
# setup form init values
|
# setup form init values
|
||||||
|
@ -1418,7 +1418,10 @@ def do_evaluation_listeetuds_groups(
|
|||||||
if not groups:
|
if not groups:
|
||||||
return [] # no groups, so no students
|
return [] # no groups, so no students
|
||||||
rg = ["gm.group_id = '%(group_id)s'" % g for g in groups]
|
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) + " )"
|
r = rq + " AND (" + " or ".join(rg) + " )"
|
||||||
fromtables += ["group_membership gm", "group_descr gd", "partition p"]
|
fromtables += ["group_membership gm", "group_descr gd", "partition p"]
|
||||||
else:
|
else:
|
||||||
@ -1458,7 +1461,15 @@ def do_evaluation_listegroupes(context, evaluation_id, include_default=False):
|
|||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||||
cursor.execute(
|
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,
|
+ c,
|
||||||
{"evaluation_id": evaluation_id},
|
{"evaluation_id": evaluation_id},
|
||||||
)
|
)
|
||||||
@ -1473,7 +1484,7 @@ def listgroups(context, group_ids):
|
|||||||
groups = []
|
groups = []
|
||||||
for group_id in group_ids:
|
for group_id in group_ids:
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"""SELECT gd.*, p.*
|
"""SELECT gd.id AS group_id, gd.*, p.id AS partition_id, p.*
|
||||||
FROM group_descr gd, partition p
|
FROM group_descr gd, partition p
|
||||||
WHERE p.id = gd.partition_id
|
WHERE p.id = gd.partition_id
|
||||||
AND gd.id = %(group_id)s
|
AND gd.id = %(group_id)s
|
||||||
|
@ -59,15 +59,16 @@ def do_evaluation_listenotes(context, REQUEST):
|
|||||||
"""
|
"""
|
||||||
Affichage des notes d'une évaluation
|
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
|
mode = None
|
||||||
if "evaluation_id" in REQUEST.form:
|
if "evaluation_id" in REQUEST.form:
|
||||||
evaluation_id = REQUEST.form["evaluation_id"]
|
evaluation_id = int(REQUEST.form["evaluation_id"])
|
||||||
mode = "eval"
|
mode = "eval"
|
||||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||||
if "moduleimpl_id" in REQUEST.form:
|
if "moduleimpl_id" in REQUEST.form:
|
||||||
moduleimpl_id = REQUEST.form["moduleimpl_id"]
|
moduleimpl_id = int(REQUEST.form["moduleimpl_id"])
|
||||||
mode = "module"
|
mode = "module"
|
||||||
evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
|
evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
|
||||||
if not mode:
|
if not mode:
|
||||||
@ -428,7 +429,7 @@ def _make_table_notes(
|
|||||||
columns_ids.append("comment")
|
columns_ids.append("comment")
|
||||||
|
|
||||||
# titres divers:
|
# 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:
|
if note_sur_20:
|
||||||
gl = "¬e_sur_20%3Alist=yes" + gl
|
gl = "¬e_sur_20%3Alist=yes" + gl
|
||||||
if anonymous_listing:
|
if anonymous_listing:
|
||||||
@ -583,7 +584,7 @@ def _add_eval_columns(
|
|||||||
val = None
|
val = None
|
||||||
|
|
||||||
if val is 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", ""):
|
if not row.get("_css_row_class", ""):
|
||||||
row["_css_row_class"] = "etudabs"
|
row["_css_row_class"] = "etudabs"
|
||||||
# regroupe les commentaires
|
# regroupe les commentaires
|
||||||
@ -599,7 +600,7 @@ def _add_eval_columns(
|
|||||||
row.update(
|
row.update(
|
||||||
{
|
{
|
||||||
evaluation_id: val_fmt,
|
evaluation_id: val_fmt,
|
||||||
"_" + evaluation_id + "_help": explanation,
|
"_" + str(evaluation_id) + "_help": explanation,
|
||||||
# si plusieurs evals seront ecrasés et non affichés:
|
# si plusieurs evals seront ecrasés et non affichés:
|
||||||
"comment": explanation,
|
"comment": explanation,
|
||||||
"expl_key": expl_key,
|
"expl_key": expl_key,
|
||||||
@ -619,7 +620,9 @@ def _add_eval_columns(
|
|||||||
|
|
||||||
if nb_notes > 0:
|
if nb_notes > 0:
|
||||||
moys[evaluation_id] = "%.3g" % (sum_notes / nb_notes)
|
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,
|
nb_notes,
|
||||||
e["description"],
|
e["description"],
|
||||||
e["jour"],
|
e["jour"],
|
||||||
@ -630,11 +633,11 @@ def _add_eval_columns(
|
|||||||
titles[evaluation_id] = "%(description)s (%(jour)s)" % e
|
titles[evaluation_id] = "%(description)s (%(jour)s)" % e
|
||||||
|
|
||||||
if e["eval_state"]["evalcomplete"]:
|
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"]:
|
elif e["eval_state"]["evalattente"]:
|
||||||
titles["_" + evaluation_id + "_td_attrs"] = 'class="eval_attente"'
|
titles["_" + str(evaluation_id) + "_td_attrs"] = 'class="eval_attente"'
|
||||||
else:
|
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
|
return notes, nb_abs, nb_att # pour histogramme
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ def do_placement_selectetuds(context, REQUEST):
|
|||||||
"""
|
"""
|
||||||
Choisi les étudiants et les infos sur la salle pour leur placement.
|
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})
|
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||||
if not E:
|
if not E:
|
||||||
raise ScoValueError("invalid evaluation_id")
|
raise ScoValueError("invalid evaluation_id")
|
||||||
@ -241,7 +241,7 @@ def do_placement(context, REQUEST):
|
|||||||
authuser = REQUEST.AUTHENTICATED_USER
|
authuser = REQUEST.AUTHENTICATED_USER
|
||||||
authusername = str(authuser)
|
authusername = str(authuser)
|
||||||
try:
|
try:
|
||||||
evaluation_id = REQUEST.form["evaluation_id"]
|
evaluation_id = int(REQUEST.form["evaluation_id"])
|
||||||
except:
|
except:
|
||||||
raise ScoValueError(
|
raise ScoValueError(
|
||||||
"Formulaire incomplet ! Vous avez sans doute attendu trop longtemps, veuillez vous reconnecter. Si le problème persiste, contacter l'administrateur. Merci."
|
"Formulaire incomplet ! Vous avez sans doute attendu trop longtemps, veuillez vous reconnecter. Si le problème persiste, contacter l'administrateur. Merci."
|
||||||
|
@ -168,7 +168,7 @@ def do_evaluation_upload_xls(context, REQUEST):
|
|||||||
Soumission d'un fichier XLS (evaluation_id, notefile)
|
Soumission d'un fichier XLS (evaluation_id, notefile)
|
||||||
"""
|
"""
|
||||||
authuser = REQUEST.AUTHENTICATED_USER
|
authuser = REQUEST.AUTHENTICATED_USER
|
||||||
evaluation_id = REQUEST.form["evaluation_id"]
|
evaluation_id = int(REQUEST.form["evaluation_id"])
|
||||||
comment = REQUEST.form["comment"]
|
comment = REQUEST.form["comment"]
|
||||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||||
M = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
M = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||||
|
Loading…
Reference in New Issue
Block a user