From 6dbbcde45470c25e67f6420315fa9acb138d2bf2 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 16 Sep 2021 08:17:26 +0200 Subject: [PATCH] unifie fichiers moodlecsv --- app/scodoc/sco_groups_view.py | 25 ++++++++++++++----------- sco_version.py | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index 1c73b6bcb..8226b49fc 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -477,6 +477,9 @@ def groups_table( [(p["partition_id"], p["partition_name"]) for p in groups_infos.partitions] ) ) + partitions_name = { + p["partition_id"]: p["partition_name"] for p in groups_infos.partitions + } if format != "html": # ne mentionne l'état que en Excel (style en html) columns_ids.append("etat") @@ -500,11 +503,7 @@ def groups_table( if with_annotations: sco_etud.add_annotations_to_etud_list(groups_infos.members) columns_ids += ["annotations_str"] - - if groups_infos.formsemestre["semestre_id"] >= 0: - moodle_sem_name = "S%d" % groups_infos.formsemestre["semestre_id"] - else: - moodle_sem_name = "A" # pas de semestre spécifié, que faire ? + moodle_sem_name = groups_infos.formsemestre["session_id"] moodle_groupenames = set() # ajoute liens for etud in groups_infos.members: @@ -529,23 +528,27 @@ def groups_table( # et groupes: for partition_id in etud["partitions"]: etud[partition_id] = etud["partitions"][partition_id]["group_name"] - # Ajoute colonne pour moodle: semestre_groupe, de la forme S1-NomgroupeXXX + # Ajoute colonne pour moodle: semestre_groupe, de la forme RT-DUT-FI-S3-2021-PARTITION-GROUPE moodle_groupename = [] if groups_infos.selected_partitions: # il y a des groupes selectionnes, utilise leurs partitions for partition_id in groups_infos.selected_partitions: if partition_id in etud["partitions"]: moodle_groupename.append( - etud["partitions"][partition_id]["group_name"] + partitions_name[partition_id] + + "-" + + etud["partitions"][partition_id]["group_name"] ) else: # pas de groupes sélectionnés: prend le premier s'il y en a un + moodle_groupename = ["tous"] if etud["partitions"]: for p in etud["partitions"].items(): # partitions is an OrderedDict + moodle_groupename = [ + partitions_name[p[0]] + "-" + p[1]["group_name"] + ] break - moodle_groupename = [p[1]["group_name"]] - else: - moodle_groupename = ["tous"] + moodle_groupenames |= set(moodle_groupename) etud["semestre_groupe"] = moodle_sem_name + "-" + "+".join(moodle_groupename) @@ -935,7 +938,7 @@ def form_choix_saisie_semaine(groups_infos, REQUEST=None): return "\n".join(FA) -def export_groups_as_moodle_csv(formsemestre_id=None, REQUEST=None): +def export_groups_as_moodle_csv(formsemestre_id=None): """Export all students/groups, in a CSV format suitable for Moodle Each (student,group) will be listed on a separate line jo@univ.fr,S3-A diff --git a/sco_version.py b/sco_version.py index a509e44c6..be14469e2 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.0.25" +SCOVERSION = "9.0.26" SCONAME = "ScoDoc"