1
0
forked from ScoDoc/ScoDoc

unifie fichiers moodlecsv

This commit is contained in:
Emmanuel Viennet 2021-09-16 08:17:26 +02:00
parent 9578c789dc
commit 6dbbcde454
2 changed files with 15 additions and 12 deletions

View File

@ -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

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.0.25"
SCOVERSION = "9.0.26"
SCONAME = "ScoDoc"