From 23e2a5c427e6494bc7798656c8aaa37195593d85 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Fri, 24 Jun 2022 16:03:35 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20des=20=C3=A9tats=20d'inscriptions=20pou?= =?UTF-8?q?r=20les=20=C3=A9tudiants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fakedatabase/create_test_api_database.py | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/tools/fakedatabase/create_test_api_database.py b/tools/fakedatabase/create_test_api_database.py index 8c7348c5..ee630e54 100644 --- a/tools/fakedatabase/create_test_api_database.py +++ b/tools/fakedatabase/create_test_api_database.py @@ -38,7 +38,7 @@ from app.models import ( NotesNotes, ApcReferentielCompetences, ApcCompetence, - Absence, + Absence, FormSemestreEtape, ) from app import db from app.models.but_refcomp import ( @@ -180,13 +180,31 @@ def create_formsemestre( def inscrit_etudiants(etuds: list, formsemestre: FormSemestre): """Inscrit les etudiants aux semestres et à tous ses modules""" for etud in etuds: - sco_formsemestre_inscriptions.do_formsemestre_inscription_with_modules( - formsemestre.id, - etud.id, - group_ids=[], - etat="I", - method="init db test", - ) + aleatoire = random.randint(0, 10) + if aleatoire <= 3: + sco_formsemestre_inscriptions.do_formsemestre_inscription_with_modules( + formsemestre.id, + etud.id, + group_ids=[], + etat="I", + method="init db test", + ) + elif 3 < aleatoire <= 6: + sco_formsemestre_inscriptions.do_formsemestre_inscription_with_modules( + formsemestre.id, + etud.id, + group_ids=[], + etat="D", + method="init db test", + ) + else: + sco_formsemestre_inscriptions.do_formsemestre_inscription_with_modules( + formsemestre.id, + etud.id, + group_ids=[], + etat="DEF", + method="init db test", + ) def create_evaluations(formsemestre: FormSemestre): @@ -480,6 +498,7 @@ def init_test_database(): saisie_notes_evaluations(formsemestre, user_lecteur) create_ref_comp(formation) add_absences(formsemestre) + create_etape_apo(formsemestre) # à compléter # - groupes # - absences