From ddf4bf788feccbbd95f47d22112d78a90200715c Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 25 Sep 2021 15:12:38 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20synchro=20Apog=C3=A9e=20quand=20=C3=A9tu?= =?UTF-8?q?diants=20ajout=C3=A9s=20manuellement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_page_etud.py | 1 + app/scodoc/sco_synchro_etuds.py | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index fc583aa5..552a28f2 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -279,6 +279,7 @@ def ficheEtud(etudid=None, REQUEST=None): l.append("") info["liste_inscriptions"] = "\n".join(l) info["link_bul_pdf"] = "" + info["link_inscrire_ailleurs"] = "" # Liste des annotations alist = [] diff --git a/app/scodoc/sco_synchro_etuds.py b/app/scodoc/sco_synchro_etuds.py index 2ac4ade4..73f0e4bf 100644 --- a/app/scodoc/sco_synchro_etuds.py +++ b/app/scodoc/sco_synchro_etuds.py @@ -126,9 +126,13 @@ def formsemestre_synchro_etuds( etuds = etuds.split(",") # vient du form de confirmation elif isinstance(etuds, int): etuds = [etuds] - if isinstance(inscrits_without_key, str): + if isinstance(inscrits_without_key, int): + inscrits_without_key = [inscrits_without_key] + elif isinstance(inscrits_without_key, str): inscrits_without_key = inscrits_without_key.split(",") - + elif not isinstance(inscrits_without_key, list): + raise ValueError("invalid type for inscrits_without_key") + inscrits_without_key = [int(x) for x in inscrits_without_key] ( etuds_by_cat, a_importer, @@ -200,31 +204,38 @@ def formsemestre_synchro_etuds( ) H.append("") - if a_desinscrire or a_desinscrire_without_key: + if a_desinscrire: H.append("

Etudiants à désinscrire :

    ") for key in a_desinscrire: etud = sco_etud.get_etud_info(filled=True, code_nip=key)[0] H.append('
  1. %(nomprenom)s
  2. ' % etud) + H.append("
") + if a_desinscrire_without_key: + H.append("

Etudiants à désinscrire (sans code):

    ") for etudid in a_desinscrire_without_key: etud = inscrits_without_key_all[etudid] sco_etud.format_etud_ident(etud) H.append('
  1. %(nomprenom)s
  2. ' % etud) H.append("
") - if not a_importer and not a_inscrire and not a_desinscrire: + todo = ( + a_importer or a_inscrire or a_desinscrire or a_desinscrire_without_key + ) + if not todo: H.append("""

Il n'y a rien à modifier !

""") - H.append( scu.confirm_dialog( dest_url="formsemestre_synchro_etuds", add_headers=False, cancel_url="formsemestre_synchro_etuds?formsemestre_id=" + str(formsemestre_id), - OK="Effectuer l'opération", + OK="Effectuer l'opération" if todo else "OK", parameters={ "formsemestre_id": formsemestre_id, "etuds": ",".join(etuds), - "inscrits_without_key": ",".join(inscrits_without_key), + "inscrits_without_key": ",".join( + [str(x) for x in inscrits_without_key] + ), "submitted": 1, "anneeapogee": anneeapogee, },