add default_partition filter in etud_add_group_infos
This commit is contained in:
parent
7da076c1bf
commit
c474e48ec8
@ -456,11 +456,13 @@ def get_etud_formsemestre_groups(
|
|||||||
|
|
||||||
|
|
||||||
# Ancienne fonction:
|
# Ancienne fonction:
|
||||||
def etud_add_group_infos(etud, formsemestre_id, sep=" ", only_to_show=False):
|
def etud_add_group_infos(
|
||||||
|
etud, formsemestre_id, sep=" ", only_to_show=False, with_default_partition=True
|
||||||
|
):
|
||||||
"""Add informations on partitions and group memberships to etud
|
"""Add informations on partitions and group memberships to etud
|
||||||
(a dict with an etudid)
|
(a dict with an etudid)
|
||||||
If only_to_show, restrict to partions such that show_in_lists is True.
|
If only_to_show, restrict to partions such that show_in_lists is True.
|
||||||
|
If with_default_partition, does not discard partition whose name is None
|
||||||
etud['partitions'] = { partition_id : group + partition_name }
|
etud['partitions'] = { partition_id : group + partition_name }
|
||||||
etud['groupes'] = "TDB, Gr2, TPB1"
|
etud['groupes'] = "TDB, Gr2, TPB1"
|
||||||
etud['partitionsgroupes'] = "Groupes TD:TDB, Groupes TP:Gr2 (...)"
|
etud['partitionsgroupes'] = "Groupes TD:TDB, Groupes TP:Gr2 (...)"
|
||||||
@ -471,7 +473,6 @@ def etud_add_group_infos(etud, formsemestre_id, sep=" ", only_to_show=False):
|
|||||||
if not formsemestre_id:
|
if not formsemestre_id:
|
||||||
etud["groupes"] = ""
|
etud["groupes"] = ""
|
||||||
return etud
|
return etud
|
||||||
|
|
||||||
infos = ndb.SimpleDictFetch(
|
infos = ndb.SimpleDictFetch(
|
||||||
"""SELECT p.partition_name, p.show_in_lists, g.*, g.id AS group_id
|
"""SELECT p.partition_name, p.show_in_lists, g.*, g.id AS group_id
|
||||||
FROM group_descr g, partition p, group_membership gm WHERE gm.etudid=%(etudid)s
|
FROM group_descr g, partition p, group_membership gm WHERE gm.etudid=%(etudid)s
|
||||||
@ -480,6 +481,7 @@ def etud_add_group_infos(etud, formsemestre_id, sep=" ", only_to_show=False):
|
|||||||
and p.formsemestre_id = %(formsemestre_id)s
|
and p.formsemestre_id = %(formsemestre_id)s
|
||||||
"""
|
"""
|
||||||
+ (" and (p.show_in_lists is True) " if only_to_show else "")
|
+ (" and (p.show_in_lists is True) " if only_to_show else "")
|
||||||
|
+ (" and (p.partition_name is not null) " if not with_default_partition else "")
|
||||||
+ """
|
+ """
|
||||||
ORDER BY p.numero
|
ORDER BY p.numero
|
||||||
""",
|
""",
|
||||||
|
@ -197,13 +197,17 @@ def sco_import_generate_excel_sample(
|
|||||||
titles_styles = [style] + titles_styles
|
titles_styles = [style] + titles_styles
|
||||||
# rempli table avec données actuelles
|
# rempli table avec données actuelles
|
||||||
lines = []
|
lines = []
|
||||||
|
breakpoint()
|
||||||
for i in members:
|
for i in members:
|
||||||
etud = sco_etud.get_etud_info(etudid=i["etudid"], filled=True)[0]
|
etud = sco_etud.get_etud_info(etudid=i["etudid"], filled=True)[0]
|
||||||
l = []
|
l = []
|
||||||
for field in titles:
|
for field in titles:
|
||||||
if field == "groupes":
|
if field == "groupes":
|
||||||
sco_groups.etud_add_group_infos(
|
sco_groups.etud_add_group_infos(
|
||||||
etud, groups_infos.formsemestre_id, sep=";"
|
etud,
|
||||||
|
groups_infos.formsemestre_id,
|
||||||
|
sep=";",
|
||||||
|
with_default_partition=False,
|
||||||
)
|
)
|
||||||
l.append(etud["partitionsgroupes"])
|
l.append(etud["partitionsgroupes"])
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user