From 6a66bbaf6239b4bbfc9b636ec41ea0ceed740f65 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 21 Aug 2021 23:45:48 +0200 Subject: [PATCH] Fix: edition enseignants de modules --- app/scodoc/sco_moduleimpl_status.py | 14 +++++++------- app/views/absences.py | 2 +- app/views/notes.py | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 92aeb34d1..0ee7bfb55 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -32,6 +32,7 @@ import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error from flask import g, url_for from flask_login import current_user +from app.auth.models import User import app.scodoc.sco_utils as scu from app.scodoc.sco_permissions import Permission @@ -178,17 +179,16 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None, REQUEST=None): caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id) arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags() # + module_resp = User.query.get(M["responsable_id"]) H = [ html_sco_header.sco_header(page_title="Module %(titre)s" % Mod), """

Module %(code)s %(titre)s

""" % Mod, - # XXX """caneditevals=%s caneditnotes=%s""" % (caneditevals,caneditnotes), """
- - - -
Responsable: """, - sco_users.user_info(M["responsable_id"])["nomprenom"], - """(%(responsable_id)s)""" % M, + + +
Responsable: """, + module_resp.get_nomcomplet(), # sco_users.user_info(M["responsable_id"])["nomprenom"], + f"""({module_resp.user_name})""", ] try: sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id) diff --git a/app/views/absences.py b/app/views/absences.py index 0068808c2..1b76a69e7 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -553,7 +553,7 @@ def SignaleAbsenceGrSemestre( nwl = 0 url_link_semaines = base_url_noweeks + "&nbweeks=%s" % nwl if moduleimpl_id: - url_link_semaines += "&moduleimpl_id=" + moduleimpl_id + url_link_semaines += "&moduleimpl_id=" + str(moduleimpl_id) # dates = [x.ISO() for x in dates] dayname = sco_abs.day_names()[jourdebut.weekday] diff --git a/app/views/notes.py b/app/views/notes.py index e684ff2cb..127c1a98b 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -686,14 +686,14 @@ def edit_enseignants_form(REQUEST, moduleimpl_id): # Liste des enseignants avec forme pour affichage / saisie avec suggestion userlist = sco_users.get_user_list() - login2display = {} # user_name : forme pour affichage = "NOM Prenom (login)" + uid2display = {} # uid : forme pour affichage = "NOM Prenom (login)"(login)" for u in userlist: - login2display[u.user_name] = u.get_nomplogin() - allowed_user_names = list(login2display.values()) + uid2display[u.id] = u.get_nomplogin() + allowed_user_names = list(uid2display.values()) H = [ "
  • %s (responsable)
  • " - % login2display.get(M["responsable_id"], M["responsable_id"]) + % uid2display.get(M["responsable_id"], M["responsable_id"]) ] for ens in M["ens"]: u = User.query.get(ens["ens_id"]) @@ -808,13 +808,13 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id): help_str = """

    Taper le début du nom de l'enseignant.

    """ # Liste des enseignants avec forme pour affichage / saisie avec suggestion userlist = [sco_users.user_info(user=u) for u in sco_users.get_user_list()] - login2display = {} # user_name : forme pour affichage = "NOM Prenom (login)" + uid2display = {} # uid : forme pour affichage = "NOM Prenom (login)" for u in userlist: - login2display[u["user_name"]] = u["nomplogin"] - allowed_user_names = list(login2display.values()) + uid2display[u["id"]] = u["nomplogin"] + allowed_user_names = list(uid2display.values()) initvalues = M - initvalues["responsable_id"] = login2display.get( + initvalues["responsable_id"] = uid2display.get( M["responsable_id"], M["responsable_id"] ) form = [ @@ -880,7 +880,7 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id): "notes.moduleimpl_status", scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id, - head_message="responsable%20modifié", + head_message="responsable modifié", ) ) @@ -1249,7 +1249,7 @@ def edit_enseignants_form_delete(REQUEST, moduleimpl_id, ens_id: int): WHERE moduleimpl_id = %(moduleimpl_id)s AND ens_id = %(ens_id)s """, - {"module_impl_id": moduleimpl_id, "ens_id": ens_id}, + {"moduleimpl_id": moduleimpl_id, "ens_id": ens_id}, ) return flask.redirect("edit_enseignants_form?moduleimpl_id=%s" % moduleimpl_id)