forked from ScoDoc/ScoDoc
9.0.25
This commit is contained in:
parent
b8b3185901
commit
831d14cf7d
@ -191,6 +191,7 @@ def compute_user_formula(
|
|||||||
return user_moy
|
return user_moy
|
||||||
|
|
||||||
|
|
||||||
|
# XXX OBSOLETE
|
||||||
def compute_moduleimpl_moyennes(nt, modimpl):
|
def compute_moduleimpl_moyennes(nt, modimpl):
|
||||||
"""Retourne dict { etudid : note_moyenne } pour tous les etuds inscrits
|
"""Retourne dict { etudid : note_moyenne } pour tous les etuds inscrits
|
||||||
au moduleimpl mod, la liste des evaluations "valides" (toutes notes entrées
|
au moduleimpl mod, la liste des evaluations "valides" (toutes notes entrées
|
||||||
@ -228,22 +229,23 @@ def compute_moduleimpl_moyennes(nt, modimpl):
|
|||||||
|
|
||||||
user_expr = moduleimpl_has_expression(modimpl)
|
user_expr = moduleimpl_has_expression(modimpl)
|
||||||
attente = False
|
attente = False
|
||||||
# recupere les notes de toutes les evaluations
|
# récupere les notes de toutes les evaluations
|
||||||
eval_rattr = None
|
eval_rattr = None
|
||||||
for e in evals:
|
for e in evals:
|
||||||
e["nb_inscrits"] = e["etat"]["nb_inscrits"]
|
e["nb_inscrits"] = e["etat"]["nb_inscrits"]
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(
|
# XXX OBSOLETE
|
||||||
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(
|
||||||
e["evaluation_id"]
|
e["evaluation_id"]
|
||||||
) # toutes, y compris demissions
|
) # toutes, y compris demissions
|
||||||
# restreint aux étudiants encore inscrits à ce module
|
# restreint aux étudiants encore inscrits à ce module
|
||||||
notes = [
|
notes = [
|
||||||
NotesDB[etudid]["value"] for etudid in NotesDB if (etudid in insmod_set)
|
notes_db[etudid]["value"] for etudid in notes_db if (etudid in insmod_set)
|
||||||
]
|
]
|
||||||
e["nb_notes"] = len(notes)
|
e["nb_notes"] = len(notes)
|
||||||
e["nb_abs"] = len([x for x in notes if x is None])
|
e["nb_abs"] = len([x for x in notes if x is None])
|
||||||
e["nb_neutre"] = len([x for x in notes if x == NOTES_NEUTRALISE])
|
e["nb_neutre"] = len([x for x in notes if x == NOTES_NEUTRALISE])
|
||||||
e["nb_att"] = len([x for x in notes if x == NOTES_ATTENTE])
|
e["nb_att"] = len([x for x in notes if x == NOTES_ATTENTE])
|
||||||
e["notes"] = NotesDB
|
e["notes"] = notes_db
|
||||||
|
|
||||||
if e["etat"]["evalattente"]:
|
if e["etat"]["evalattente"]:
|
||||||
attente = True
|
attente = True
|
||||||
|
@ -85,7 +85,7 @@ def evaluation_check_absences(evaluation_id):
|
|||||||
Justs = set([x["etudid"] for x in Just]) # ensemble des etudiants avec justif
|
Justs = set([x["etudid"] for x in Just]) # ensemble des etudiants avec justif
|
||||||
|
|
||||||
# Les notes:
|
# Les notes:
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
ValButAbs = [] # une note mais noté absent
|
ValButAbs = [] # une note mais noté absent
|
||||||
AbsNonSignalee = [] # note ABS mais pas noté absent
|
AbsNonSignalee = [] # note ABS mais pas noté absent
|
||||||
ExcNonSignalee = [] # note EXC mais pas noté absent
|
ExcNonSignalee = [] # note EXC mais pas noté absent
|
||||||
@ -94,8 +94,8 @@ def evaluation_check_absences(evaluation_id):
|
|||||||
for etudid, _ in sco_groups.do_evaluation_listeetuds_groups(
|
for etudid, _ in sco_groups.do_evaluation_listeetuds_groups(
|
||||||
evaluation_id, getallstudents=True
|
evaluation_id, getallstudents=True
|
||||||
):
|
):
|
||||||
if etudid in NotesDB:
|
if etudid in notes_db:
|
||||||
val = NotesDB[etudid]["value"]
|
val = notes_db[etudid]["value"]
|
||||||
if (
|
if (
|
||||||
val != None and val != scu.NOTES_NEUTRALISE and val != scu.NOTES_ATTENTE
|
val != None and val != scu.NOTES_NEUTRALISE and val != scu.NOTES_ATTENTE
|
||||||
) and etudid in As:
|
) and etudid in As:
|
||||||
|
@ -306,8 +306,8 @@ def do_evaluation_delete(evaluation_id):
|
|||||||
raise AccessDenied(
|
raise AccessDenied(
|
||||||
"Modification évaluation impossible pour %s" % current_user.get_nomplogin()
|
"Modification évaluation impossible pour %s" % current_user.get_nomplogin()
|
||||||
)
|
)
|
||||||
NotesDB = do_evaluation_get_all_notes(evaluation_id) # { etudid : value }
|
notes_db = do_evaluation_get_all_notes(evaluation_id) # { etudid : value }
|
||||||
notes = [x["value"] for x in NotesDB.values()]
|
notes = [x["value"] for x in notes_db.values()]
|
||||||
if notes:
|
if notes:
|
||||||
raise ScoValueError(
|
raise ScoValueError(
|
||||||
"Impossible de supprimer cette évaluation: il reste des notes"
|
"Impossible de supprimer cette évaluation: il reste des notes"
|
||||||
|
@ -653,11 +653,11 @@ def _add_eval_columns(
|
|||||||
notes = [] # liste des notes numeriques, pour calcul histogramme uniquement
|
notes = [] # liste des notes numeriques, pour calcul histogramme uniquement
|
||||||
evaluation_id = e["evaluation_id"]
|
evaluation_id = e["evaluation_id"]
|
||||||
e_o = Evaluation.query.get(evaluation_id) # XXX en attendant ré-écriture
|
e_o = Evaluation.query.get(evaluation_id) # XXX en attendant ré-écriture
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
etudid = row["etudid"]
|
etudid = row["etudid"]
|
||||||
if etudid in NotesDB:
|
if etudid in notes_db:
|
||||||
val = NotesDB[etudid]["value"]
|
val = notes_db[etudid]["value"]
|
||||||
if val is None:
|
if val is None:
|
||||||
nb_abs += 1
|
nb_abs += 1
|
||||||
if val == scu.NOTES_ATTENTE:
|
if val == scu.NOTES_ATTENTE:
|
||||||
@ -674,12 +674,12 @@ def _add_eval_columns(
|
|||||||
nb_notes = nb_notes + 1
|
nb_notes = nb_notes + 1
|
||||||
sum_notes += val
|
sum_notes += val
|
||||||
val_fmt = scu.fmt_note(val, keep_numeric=keep_numeric)
|
val_fmt = scu.fmt_note(val, keep_numeric=keep_numeric)
|
||||||
comment = NotesDB[etudid]["comment"]
|
comment = notes_db[etudid]["comment"]
|
||||||
if comment is None:
|
if comment is None:
|
||||||
comment = ""
|
comment = ""
|
||||||
explanation = "%s (%s) %s" % (
|
explanation = "%s (%s) %s" % (
|
||||||
NotesDB[etudid]["date"].strftime("%d/%m/%y %Hh%M"),
|
notes_db[etudid]["date"].strftime("%d/%m/%y %Hh%M"),
|
||||||
sco_users.user_info(NotesDB[etudid]["uid"])["nomcomplet"],
|
sco_users.user_info(notes_db[etudid]["uid"])["nomcomplet"],
|
||||||
comment,
|
comment,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -308,13 +308,13 @@ def do_evaluation_set_missing(evaluation_id, value, dialog_confirmed=False):
|
|||||||
# XXX imaginer un redirect + msg erreur
|
# XXX imaginer un redirect + msg erreur
|
||||||
raise AccessDenied("Modification des notes impossible pour %s" % current_user)
|
raise AccessDenied("Modification des notes impossible pour %s" % current_user)
|
||||||
#
|
#
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
etudid_etats = sco_groups.do_evaluation_listeetuds_groups(
|
etudid_etats = sco_groups.do_evaluation_listeetuds_groups(
|
||||||
evaluation_id, getallstudents=True, include_dems=False
|
evaluation_id, getallstudents=True, include_dems=False
|
||||||
)
|
)
|
||||||
notes = []
|
notes = []
|
||||||
for etudid, _ in etudid_etats: # pour tous les inscrits
|
for etudid, _ in etudid_etats: # pour tous les inscrits
|
||||||
if etudid not in NotesDB: # pas de note
|
if etudid not in notes_db: # pas de note
|
||||||
notes.append((etudid, value))
|
notes.append((etudid, value))
|
||||||
# Check value
|
# Check value
|
||||||
L, invalids, _, _, _ = _check_notes(notes, E, M["module"])
|
L, invalids, _, _, _ = _check_notes(notes, E, M["module"])
|
||||||
@ -393,18 +393,18 @@ def evaluation_suppress_alln(evaluation_id, dialog_confirmed=False):
|
|||||||
):
|
):
|
||||||
# On a le droit de modifier toutes les notes
|
# On a le droit de modifier toutes les notes
|
||||||
# recupere les etuds ayant une note
|
# recupere les etuds ayant une note
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
elif sco_permissions_check.can_edit_notes(
|
elif sco_permissions_check.can_edit_notes(
|
||||||
current_user, E["moduleimpl_id"], allow_ens=True
|
current_user, E["moduleimpl_id"], allow_ens=True
|
||||||
):
|
):
|
||||||
# Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi
|
# Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(
|
||||||
evaluation_id, by_uid=current_user.id
|
evaluation_id, by_uid=current_user.id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise AccessDenied("Modification des notes impossible pour %s" % current_user)
|
raise AccessDenied("Modification des notes impossible pour %s" % current_user)
|
||||||
|
|
||||||
notes = [(etudid, scu.NOTES_SUPPRESS) for etudid in NotesDB.keys()]
|
notes = [(etudid, scu.NOTES_SUPPRESS) for etudid in notes_db.keys()]
|
||||||
|
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
nb_changed, nb_suppress, existing_decisions = notes_add(
|
nb_changed, nb_suppress, existing_decisions = notes_add(
|
||||||
@ -493,7 +493,7 @@ def notes_add(
|
|||||||
"etudiant %s: valeur de note invalide (%s)" % (etudid, value)
|
"etudiant %s: valeur de note invalide (%s)" % (etudid, value)
|
||||||
)
|
)
|
||||||
# Recherche notes existantes
|
# Recherche notes existantes
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
# Met a jour la base
|
# Met a jour la base
|
||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||||
@ -507,7 +507,7 @@ def notes_add(
|
|||||||
try:
|
try:
|
||||||
for (etudid, value) in notes:
|
for (etudid, value) in notes:
|
||||||
changed = False
|
changed = False
|
||||||
if etudid not in NotesDB:
|
if etudid not in notes_db:
|
||||||
# nouvelle note
|
# nouvelle note
|
||||||
if value != scu.NOTES_SUPPRESS:
|
if value != scu.NOTES_SUPPRESS:
|
||||||
if do_it:
|
if do_it:
|
||||||
@ -530,7 +530,7 @@ def notes_add(
|
|||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
# il y a deja une note
|
# il y a deja une note
|
||||||
oldval = NotesDB[etudid]["value"]
|
oldval = notes_db[etudid]["value"]
|
||||||
if type(value) != type(oldval):
|
if type(value) != type(oldval):
|
||||||
changed = True
|
changed = True
|
||||||
elif type(value) == type(1.0) and (
|
elif type(value) == type(1.0) and (
|
||||||
|
Loading…
Reference in New Issue
Block a user