2021-05-21 08:54:30 +02:00
|
|
|
import sco_formations
|
|
|
|
import random
|
2021-05-31 13:31:53 +02:00
|
|
|
|
2021-05-21 08:54:30 +02:00
|
|
|
# La variable context est définie par le script de lancement
|
|
|
|
# l'affecte ainsi pour évietr les warnins pylint:
|
|
|
|
context = context # pylint: disable=undefined-variable
|
|
|
|
REQUEST = REQUEST # pylint: disable=undefined-variable
|
|
|
|
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
|
|
|
import sco_moduleimpl
|
|
|
|
|
|
|
|
G = sco_fake_gen.ScoFake(context.Notes)
|
|
|
|
G.verbose = False
|
|
|
|
|
|
|
|
file = open("scotests/export_formation1.xml")
|
|
|
|
doc = file.read()
|
|
|
|
file.close()
|
|
|
|
|
|
|
|
|
|
|
|
# --- Création de la formation
|
|
|
|
|
|
|
|
f = sco_formations.formation_import_xml(REQUEST=REQUEST, doc=doc, context=context.Notes)
|
|
|
|
|
2021-05-31 13:31:53 +02:00
|
|
|
# --- Création des semestres
|
2021-05-21 08:54:30 +02:00
|
|
|
|
|
|
|
sem1 = G.create_formsemestre(
|
|
|
|
formation_id=f[0],
|
|
|
|
semestre_id=1,
|
|
|
|
date_debut="01/09/2020",
|
|
|
|
date_fin="01/02/2021",
|
|
|
|
)
|
|
|
|
|
|
|
|
sem3 = G.create_formsemestre(
|
|
|
|
formation_id=f[0],
|
|
|
|
semestre_id=3,
|
|
|
|
date_debut="01/09/2020",
|
|
|
|
date_fin="01/02/2021",
|
|
|
|
)
|
|
|
|
|
|
|
|
sem2 = G.create_formsemestre(
|
|
|
|
formation_id=f[0],
|
|
|
|
semestre_id=2,
|
|
|
|
date_debut="02/02/2021",
|
|
|
|
date_fin="01/06/2021",
|
|
|
|
)
|
|
|
|
|
|
|
|
sem4 = G.create_formsemestre(
|
|
|
|
formation_id=f[0],
|
|
|
|
semestre_id=4,
|
|
|
|
date_debut="02/02/2021",
|
|
|
|
date_fin="01/06/2021",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Implémentation des modules
|
|
|
|
|
|
|
|
li_module = context.Notes.do_module_list()
|
|
|
|
mods_imp = []
|
2021-05-31 13:31:53 +02:00
|
|
|
for mod in li_module:
|
|
|
|
if mod["semestre_id"] == 1:
|
2021-05-21 08:54:30 +02:00
|
|
|
formsemestre_id = sem1["formsemestre_id"]
|
2021-05-31 13:31:53 +02:00
|
|
|
elif mod["semestre_id"] == 2:
|
2021-05-21 08:54:30 +02:00
|
|
|
formsemestre_id = sem2["formsemestre_id"]
|
2021-05-31 13:31:53 +02:00
|
|
|
elif mod["semestre_id"] == 3:
|
2021-05-21 08:54:30 +02:00
|
|
|
formsemestre_id = sem3["formsemestre_id"]
|
2021-05-31 13:31:53 +02:00
|
|
|
else:
|
2021-05-21 08:54:30 +02:00
|
|
|
formsemestre_id = sem4["formsemestre_id"]
|
|
|
|
|
|
|
|
mi = G.create_moduleimpl(
|
2021-05-31 13:31:53 +02:00
|
|
|
module_id=mod["module_id"],
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
responsable_id="bach",
|
2021-05-21 08:54:30 +02:00
|
|
|
)
|
|
|
|
mods_imp.append(mi)
|
|
|
|
|
|
|
|
# --- Création des étudiants
|
|
|
|
|
2021-05-31 13:31:53 +02:00
|
|
|
etuds = []
|
2021-05-21 08:54:30 +02:00
|
|
|
for nom, prenom in [
|
2021-05-31 13:31:53 +02:00
|
|
|
("Semestre11", "EtudiantNumero1"),
|
|
|
|
("Semestre12", "EtudiantNumero2"),
|
|
|
|
("Semestre23", "EtudiantNumero3"),
|
|
|
|
("Semestre24", "EtudiantNumero4"),
|
|
|
|
("Semestre35", "EtudiantNumero5"),
|
|
|
|
("Semestre36", "EtudiantNumero6"),
|
|
|
|
("Semestre47", "EtudiantNumero7"),
|
|
|
|
("Semestre48", "EtudiantNumero8"),
|
|
|
|
]:
|
2021-05-21 08:54:30 +02:00
|
|
|
etud = G.create_etud(
|
|
|
|
nom=nom,
|
|
|
|
prenom=prenom,
|
|
|
|
)
|
|
|
|
etuds.append(etud)
|
|
|
|
|
|
|
|
# --- Inscription des étudiants
|
|
|
|
|
|
|
|
for etud in etuds[0:2]:
|
|
|
|
G.inscrit_etudiant(sem1, etud)
|
|
|
|
|
|
|
|
for etud in etuds[2:4]:
|
|
|
|
G.inscrit_etudiant(sem2, etud)
|
|
|
|
|
|
|
|
for etud in etuds[4:6]:
|
|
|
|
G.inscrit_etudiant(sem3, etud)
|
|
|
|
|
|
|
|
for etud in etuds[6:]:
|
|
|
|
G.inscrit_etudiant(sem4, etud)
|