diff --git a/app/scodoc/notesdb.py b/app/scodoc/notesdb.py index 96da43a9b4..18ae651771 100644 --- a/app/scodoc/notesdb.py +++ b/app/scodoc/notesdb.py @@ -220,6 +220,7 @@ def DBSelectArgs( except: log('Exception in DBSelectArgs:\n\treq="%s"\n\tvals="%s"\n' % (req, vals)) log(traceback.format_exc()) + cnx.rollback() raise ScoException() return cursor.dictfetchall() diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py index bc19789fa5..51ef7d46ea 100644 --- a/app/scodoc/sco_etud.py +++ b/app/scodoc/sco_etud.py @@ -1004,7 +1004,13 @@ def descr_situation_etud(context, etudid, ne=""): cnx = ndb.GetDBConnexion() cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) cursor.execute( - "select I.formsemestre_id, I.etat from notes_formsemestre_inscription I, notes_formsemestre S where etudid=%(etudid)s and S.formsemestre_id = I.formsemestre_id and date_debut < now() and date_fin > now() order by S.date_debut desc;", + """SELECT I.formsemestre_id, I.etat + FROM notes_formsemestre_inscription I, notes_formsemestre S + WHERE etudid=%(etudid)s + and S.id = I.formsemestre_id + and date_debut < now() + and date_fin > now() + ORDER BY S.date_debut DESC;""", {"etudid": etudid}, ) r = cursor.dictfetchone() diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index afd2d2baa9..99eaed33f7 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -1473,7 +1473,11 @@ def listgroups(context, group_ids): groups = [] for group_id in group_ids: cursor.execute( - "SELECT gd.*, p.* FROM group_descr gd, partition p WHERE p.partition_id = gd.partition_id AND gd.group_id = %(group_id)s", + """SELECT gd.*, p.* + FROM group_descr gd, partition p + WHERE p.id = gd.partition_id + AND gd.id = %(group_id)s + """, {"group_id": group_id}, ) r = cursor.dictfetchall() diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 067c8b2149..5af63d651d 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -48,7 +48,7 @@ from app.scodoc.sco_exceptions import ( ) from app.scodoc.sco_permissions import Permission from app.scodoc.TrivialFormulator import TrivialFormulator, TF -from app.scodoc import html_sco_header +from app.scodoc import html_sco_header, sco_users from app.scodoc import htmlutils from app.scodoc import sco_abs from app.scodoc import sco_cache @@ -142,6 +142,7 @@ def _check_notes(notes, evaluation, mod): for (etudid, note) in notes: note = str(note).strip().upper() + etudid = int(etudid) # if note[:3] == "DEM": continue # skip ! if note: @@ -198,7 +199,7 @@ def do_evaluation_upload_xls(context, REQUEST): diag.append("Erreur: format invalide ! (pas de ligne evaluation_id)") raise InvalidNoteValue() - eval_id = lines[i][0].strip()[1:] + eval_id = int(lines[i][0].strip()[1:]) if eval_id != evaluation_id: diag.append( "Erreur: fichier invalide: le code d'évaluation de correspond pas ! ('%s' != '%s')" @@ -505,7 +506,13 @@ def _notes_add( # recopie l'ancienne note dans notes_notes_log, puis update if do_it: cursor.execute( - "insert into notes_notes_log (etudid,evaluation_id,value,comment,date,uid) select etudid,evaluation_id,value,comment,date,uid from notes_notes where etudid=%(etudid)s and evaluation_id=%(evaluation_id)s", + """INSERT INTO notes_notes_log + (etudid,evaluation_id,value,comment,date,uid) + SELECT etudid, evaluation_id, value, comment, date, uid + FROM notes_notes + WHERE etudid=%(etudid)s + and evaluation_id=%(evaluation_id)s + """, {"etudid": etudid, "evaluation_id": evaluation_id}, ) aa = { @@ -520,7 +527,11 @@ def _notes_add( if value != scu.NOTES_SUPPRESS: if do_it: cursor.execute( - "update notes_notes set value=%(value)s, comment=%(comment)s, date=%(date)s, uid=%(uid)s where etudid=%(etudid)s and evaluation_id=%(evaluation_id)s", + """UPDATE notes_notes + SET value=%(value)s, comment=%(comment)s, date=%(date)s, uid=%(uid)s + WHERE etudid = %(etudid)s + and evaluation_id = %(evaluation_id)s + """, aa, ) else: # suppression ancienne note @@ -530,13 +541,18 @@ def _notes_add( % (evaluation_id, etudid, oldval) ) cursor.execute( - "delete from notes_notes where etudid=%(etudid)s and evaluation_id=%(evaluation_id)s", + """DELETE FROM notes_notes + WHERE etudid = %(etudid)s + AND evaluation_id = %(evaluation_id)s + """, aa, ) # garde trace de la suppression dans l'historique: aa["value"] = scu.NOTES_SUPPRESS cursor.execute( - "insert into notes_notes_log (etudid,evaluation_id,value,comment,date,uid) values (%(etudid)s, %(evaluation_id)s, %(value)s, %(comment)s, %(date)s, %(uid)s)", + """INSERT INTO notes_notes_log (etudid,evaluation_id,value,comment,date,uid) + VALUES (%(etudid)s, %(evaluation_id)s, %(value)s, %(comment)s, %(date)s, %(uid)s) + """, aa, ) nb_suppress += 1 @@ -748,6 +764,7 @@ def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None): formsemestre_id = M["formsemestre_id"] Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] sem = sco_formsemestre.get_formsemestre(context, M["formsemestre_id"]) + mod_responsable = sco_users.user_info(M["responsable_id"]) if E["jour"]: indication_date = ndb.DateDMYtoISO(E["jour"]) else: @@ -762,7 +779,7 @@ def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None): evaltitre, Mod["abbrev"], Mod["code"], - scu.strcapitalize(M["responsable_id"]), + mod_responsable["prenomnom"], ) groups_infos = sco_groups_view.DisplayedGroupsInfos( @@ -1098,7 +1115,7 @@ def _form_saisie_notes(context, E, M, group_ids, destination="", REQUEST=None): disabled_attr = "" # attribue a chaque element une classe css par groupe: for group_info in e["groups"]: - etud_classes.append(group_info["group_id"]) + etud_classes.append("group-" + str(group_info["group_id"])) label = ( '' % classdem @@ -1144,7 +1161,9 @@ def _form_saisie_notes(context, E, M, group_ids, destination="", REQUEST=None): ], "template": """%(label)s%(elem)s""", + + """">%(label)s + %(elem)s + """, }, ) ) @@ -1174,7 +1193,7 @@ def _form_saisie_notes(context, E, M, group_ids, destination="", REQUEST=None): if tf.canceled(): return None elif (not tf.submitted()) or not tf.result: - # ajout formularie saisie notes manquantes + # ajout formulaire saisie notes manquantes H.append( """
diff --git a/app/static/js/groups_view.js b/app/static/js/groups_view.js index 54476d5fff..8bfe49e49b 100644 --- a/app/static/js/groups_view.js +++ b/app/static/js/groups_view.js @@ -88,7 +88,7 @@ function toggle_visible_etuds() { var qargs = ""; $("#group_ids_sel option:selected").each(function (index, opt) { var group_id = opt.value; - $("." + group_id).show(); + $(".group-" + group_id).show(); qargs += "&group_ids=" + group_id; }); // Update url saisie tableur: