forked from ScoDoc/ScoDoc
ajout d'absences aux étudiants de manière aléatoire dans le script de création de la base de test
This commit is contained in:
parent
809d98df0a
commit
9faf1c48ae
@ -28,12 +28,12 @@ class Absence(db.Model):
|
|||||||
# (mettre à NULL sans supprimer)
|
# (mettre à NULL sans supprimer)
|
||||||
|
|
||||||
def __init__(self, id, etudid, jour, estabs, estjust, matin, description):
|
def __init__(self, id, etudid, jour, estabs, estjust, matin, description):
|
||||||
self.id = id,
|
self.id = id
|
||||||
self.etudid = etudid,
|
self.etudid = etudid
|
||||||
self.jour = jour,
|
self.jour = jour
|
||||||
self.estabs = estabs,
|
self.estabs = estabs
|
||||||
self.estjust = estjust,
|
self.estjust = estjust
|
||||||
self.matin = matin,
|
self.matin = matin
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
FLASK_DEBUG=1
|
FLASK_DEBUG=1
|
||||||
|
|
||||||
2) En tant qu'utilisateur scodoc, lancer:
|
2) En tant qu'utilisateur scodoc, lancer:
|
||||||
tools/create_database.sh SCODOC_TEST_API_EVAL
|
tools/create_database.sh
|
||||||
flask db upgrade
|
flask db upgrade
|
||||||
flask sco-db-init --erase
|
flask sco-db-init --erase
|
||||||
flask init-test-database
|
flask init-test-database
|
||||||
@ -37,7 +37,8 @@ from app.models import (
|
|||||||
ModuleImpl,
|
ModuleImpl,
|
||||||
NotesNotes,
|
NotesNotes,
|
||||||
ApcReferentielCompetences,
|
ApcReferentielCompetences,
|
||||||
ApcCompetence, Absence,
|
ApcCompetence,
|
||||||
|
Absence,
|
||||||
)
|
)
|
||||||
from app import db
|
from app import db
|
||||||
from app.models.but_refcomp import (
|
from app.models.but_refcomp import (
|
||||||
@ -444,9 +445,8 @@ def add_absences(formsemestre: FormSemestre):
|
|||||||
date_fin = formsemestre.date_fin
|
date_fin = formsemestre.date_fin
|
||||||
|
|
||||||
etuds = formsemestre.etuds
|
etuds = formsemestre.etuds
|
||||||
# list_etuds = []
|
|
||||||
for etu in etuds:
|
|
||||||
id_db = 1
|
id_db = 1
|
||||||
|
for etu in etuds:
|
||||||
aleatoire = random.randint(0, 1)
|
aleatoire = random.randint(0, 1)
|
||||||
if aleatoire == 1:
|
if aleatoire == 1:
|
||||||
nb_absences = random.randint(1, 5)
|
nb_absences = random.randint(1, 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user