From 483c86d904078f52d9de0bcca7a114f8835daf4f Mon Sep 17 00:00:00 2001 From: iziram Date: Wed, 6 Sep 2023 15:09:43 +0200 Subject: [PATCH] Assiduites : fix #698 et #697 --- app/scodoc/sco_groups_view.py | 90 +++++++++-------------------- app/scodoc/sco_moduleimpl_status.py | 15 +++++ app/views/assiduites.py | 9 ++- 3 files changed, 49 insertions(+), 65 deletions(-) diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index b27098ef2..728ccb363 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -833,7 +833,7 @@ def tab_absences_html(groups_infos, etat=None): "
  • ", form_choix_jour_saisie_hebdo(groups_infos), "
  • ", - f"""
  • État des assiduités du groupe
  • """, "", @@ -890,76 +890,38 @@ def form_choix_jour_saisie_hebdo(groups_infos, moduleimpl_id=None): authuser = current_user if not authuser.has_permission(Permission.ScoAbsChange): return "" - sem = groups_infos.formsemestre - first_monday = sco_cal.ddmmyyyy(sem["date_debut"]).prev_monday() - today_idx = datetime.date.today().weekday() - - FA = [] # formulaire avec menu saisi absences - FA.append( - # TODO-ASSIDUITE et utiliser url_for... (was Absences/SignaleAbsenceGrSemestre) - '
    ' - ) - FA.append('' % sem) - FA.append(groups_infos.get_form_elem()) - if moduleimpl_id: - FA.append( - '' % moduleimpl_id - ) - FA.append('') - - FA.append( - """""" - ) - FA.append("""") - FA.append("
    ") - return "\n".join(FA) + return f""" + + """ -# Ajout Le Havre -# Formulaire saisie absences semaine +# Saisie de l'assiduité par semaine def form_choix_saisie_semaine(groups_infos): authuser = current_user if not authuser.has_permission(Permission.ScoAbsChange): return "" - # construit l'URL "destination" - # (a laquelle on revient apres saisie absences) query_args = parse_qs(request.query_string) - moduleimpl_id = query_args.get("moduleimpl_id", [""])[0] - if "head_message" in query_args: - del query_args["head_message"] - destination = "%s?%s" % ( - request.base_url, - urllib.parse.urlencode(query_args, True), - ) - destination = destination.replace( - "%", "%%" - ) # car ici utilisee dans un format string ! - - DateJour = time.strftime("%d/%m/%Y") - datelundi = sco_cal.ddmmyyyy(DateJour).prev_monday() - FA = [] # formulaire avec menu saisie hebdo des absences - # XXX TODO-ASSIDUITE et utiliser un POST - FA.append('
    ') - FA.append('' % datelundi) - FA.append('' % moduleimpl_id) - FA.append('' % destination) - FA.append(groups_infos.get_form_elem()) - FA.append( - '' - ) # XXX - FA.append("
    ") - return "\n".join(FA) + moduleimpl_id = query_args.get("moduleimpl_id", [None])[0] + semaine = datetime.date.today().isocalendar().week + return f""" + + """ def export_groups_as_moodle_csv(formsemestre_id=None): diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 8d438d79b..68c04f012 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -331,6 +331,21 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None): }&formsemestre_id={formsemestre.id} &moduleimpl_id={moduleimpl_id} " + >Saisie Absences journée + """ + ) + + H.append( + f""" + Saisie Absences hebdo """ ) diff --git a/app/views/assiduites.py b/app/views/assiduites.py index 4e13e8076..958a3ae5c 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -1002,7 +1002,9 @@ def signal_assiduites_diff(): "assiduites/pages/signal_assiduites_diff.j2", diff=_differee( etudiants=etudiants, - moduleimpl_select=_module_selector(formsemestre), + moduleimpl_select=_module_selector( + formsemestre, request.args.get("moduleimpl_id", None) + ), date=date, periode={ "deb": formsemestre.date_debut.isoformat(), @@ -1162,6 +1164,11 @@ def _module_selector( ) modules.append({"moduleimpl_id": modimpl["moduleimpl_id"], "name": modname}) + try: + moduleimpl_id = int(moduleimpl_id) + except (ValueError, TypeError): + moduleimpl_id = None + return render_template( "assiduites/widgets/moduleimpl_selector.j2", selected=selected,