mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Use customInit in testDB.py
This commit is contained in:
parent
53a14c0c40
commit
1aa6737cd0
1 changed files with 13 additions and 21 deletions
34
testDB.py
34
testDB.py
|
@ -46,20 +46,20 @@ with app.app_context():
|
||||||
db.session.add(student2)
|
db.session.add(student2)
|
||||||
db.session.add(student3)
|
db.session.add(student3)
|
||||||
|
|
||||||
g1 = Group(number=1, program=program1)
|
ps1 = PartStudent.customInit(student=student1, part=part1)
|
||||||
g2 = Group(number=1, program=program2)
|
ps2 = PartStudent.customInit(student=student2, part=part1)
|
||||||
|
ps3 = PartStudent.customInit(student=student3, part=part2)
|
||||||
db.session.add(g1)
|
|
||||||
db.session.add(g2)
|
|
||||||
|
|
||||||
ps1 = PartStudent(student=student1, part=part1, group=g1)
|
|
||||||
ps2 = PartStudent(student=student2, part=part1, group=g1)
|
|
||||||
ps3 = PartStudent(student=student3, part=part2, group=g2)
|
|
||||||
|
|
||||||
db.session.add(ps1)
|
db.session.add(ps1)
|
||||||
db.session.add(ps2)
|
db.session.add(ps2)
|
||||||
db.session.add(ps3)
|
db.session.add(ps3)
|
||||||
|
|
||||||
|
g1 = Group.customInit(part_students=[ps1, ps2])
|
||||||
|
g2 = Group.customInit(part_students=[ps3])
|
||||||
|
|
||||||
|
db.session.add(g1)
|
||||||
|
db.session.add(g2)
|
||||||
|
|
||||||
ex1 = Experiment(
|
ex1 = Experiment(
|
||||||
number=1,
|
number=1,
|
||||||
program=program1,
|
program=program1,
|
||||||
|
@ -95,8 +95,8 @@ with app.app_context():
|
||||||
db.session.add(sx1)
|
db.session.add(sx1)
|
||||||
db.session.add(sx2)
|
db.session.add(sx2)
|
||||||
|
|
||||||
gx1 = GroupExperiment(semester_experiment=sx1, group=g1)
|
gx1 = GroupExperiment.customInit(semester_experiment=sx1, group=g1)
|
||||||
gx2 = GroupExperiment(semester_experiment=sx2, group=g2)
|
gx2 = GroupExperiment.customInit(semester_experiment=sx2, group=g2)
|
||||||
|
|
||||||
db.session.add(gx1)
|
db.session.add(gx1)
|
||||||
db.session.add(gx2)
|
db.session.add(gx2)
|
||||||
|
@ -124,18 +124,10 @@ with app.app_context():
|
||||||
db.session.add(as1)
|
db.session.add(as1)
|
||||||
db.session.add(as2)
|
db.session.add(as2)
|
||||||
|
|
||||||
ap1 = Appointment(date=date(2021, 3, 21), special=True, group_experiment=gx1, assistant=as1)
|
ap1 = Appointment.customInit(date=date(2021, 3, 21), special=True, assistant=as1, group_experiment=gx1)
|
||||||
ap2 = Appointment(date=date(2021, 3, 22), special=True, group_experiment=gx2, assistant=as2)
|
ap2 = Appointment.customInit(date=date(2021, 3, 22), special=True, assistant=as2, group_experiment=gx2)
|
||||||
|
|
||||||
db.session.add(ap1)
|
db.session.add(ap1)
|
||||||
db.session.add(ap2)
|
db.session.add(ap2)
|
||||||
|
|
||||||
em1 = ExperimentMark(oral_mark=11, protocol_mark=14, part_student=ps1, group_experiment=gx1, assistant=as1)
|
|
||||||
em2 = ExperimentMark(oral_mark=12, protocol_mark=14, part_student=ps2, group_experiment=gx1, assistant=as1)
|
|
||||||
em3 = ExperimentMark(oral_mark=13, protocol_mark=14, part_student=ps3, group_experiment=gx2, assistant=as2)
|
|
||||||
|
|
||||||
db.session.add(em1)
|
|
||||||
db.session.add(em2)
|
|
||||||
db.session.add(em3)
|
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
Loading…
Reference in a new issue