From 9faf1c48ae20c488e8bff6bbce066e2b34442f2d Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Tue, 21 Jun 2022 15:37:37 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20d'absences=20aux=20=C3=A9tudiants=20de?= =?UTF-8?q?=20mani=C3=A8re=20al=C3=A9atoire=20dans=20le=20script=20de=20cr?= =?UTF-8?q?=C3=A9ation=20de=20la=20base=20de=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/absences.py | 12 ++++++------ tools/fakedatabase/create_test_api_database.py | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/absences.py b/app/models/absences.py index d3ea00356..0dea5f187 100644 --- a/app/models/absences.py +++ b/app/models/absences.py @@ -28,12 +28,12 @@ class Absence(db.Model): # (mettre à NULL sans supprimer) def __init__(self, id, etudid, jour, estabs, estjust, matin, description): - self.id = id, - self.etudid = etudid, - self.jour = jour, - self.estabs = estabs, - self.estjust = estjust, - self.matin = matin, + self.id = id + self.etudid = etudid + self.jour = jour + self.estabs = estabs + self.estjust = estjust + self.matin = matin self.description = description def to_dict(self): diff --git a/tools/fakedatabase/create_test_api_database.py b/tools/fakedatabase/create_test_api_database.py index 9820e8871..8c7348c53 100644 --- a/tools/fakedatabase/create_test_api_database.py +++ b/tools/fakedatabase/create_test_api_database.py @@ -10,7 +10,7 @@ FLASK_DEBUG=1 2) En tant qu'utilisateur scodoc, lancer: - tools/create_database.sh SCODOC_TEST_API_EVAL + tools/create_database.sh flask db upgrade flask sco-db-init --erase flask init-test-database @@ -37,7 +37,8 @@ from app.models import ( ModuleImpl, NotesNotes, ApcReferentielCompetences, - ApcCompetence, Absence, + ApcCompetence, + Absence, ) from app import db from app.models.but_refcomp import ( @@ -423,7 +424,7 @@ def create_ref_comp(formation: Formation): apc_referentiel_competences_type_departement, apc_referentiel_competences_version_orebut, apc_referentiel_competences_xml_attribs, - #apc_referentiel_competences_scodoc_date_loaded, + # apc_referentiel_competences_scodoc_date_loaded, apc_referentiel_competences_scodoc_orig_filename, # apc_referentiel_competences_competences, # apc_referentiel_competences_parcours, @@ -444,9 +445,8 @@ def add_absences(formsemestre: FormSemestre): date_fin = formsemestre.date_fin etuds = formsemestre.etuds - # list_etuds = [] + id_db = 1 for etu in etuds: - id_db = 1 aleatoire = random.randint(0, 1) if aleatoire == 1: nb_absences = random.randint(1, 5)