Update generovani testovacich dat

- resitele uz nemuzou odevzdat vice reseni do jednoho cisla
This commit is contained in:
Tomas Gavenciak 2015-03-24 01:10:36 +01:00
parent cd3097ba5c
commit 7c077ed9d5

View file

@ -39,6 +39,7 @@ def create_test_data():
Resitel.objects.create(skola = skola, datum_prihlaseni = datetime.date(rnd.randint(2002, 2014), rnd.randint(1,12), 1), Resitel.objects.create(skola = skola, datum_prihlaseni = datetime.date(rnd.randint(2002, 2014), rnd.randint(1,12), 1),
jmeno = u'Řešitel' if pohlavi else u'Řešitelka', prijmeni = 'Číslo-%s' % (i), rok_maturity = rnd.randint(2015, 2019), jmeno = u'Řešitel' if pohlavi else u'Řešitelka', prijmeni = 'Číslo-%s' % (i), rok_maturity = rnd.randint(2015, 2019),
stat = skola.stat, zasilat = Resitel.ZASILAT_NIKAM, pohlavi_muz = pohlavi) stat = skola.stat, zasilat = Resitel.ZASILAT_NIKAM, pohlavi_muz = pohlavi)
resitele = list(Resitel.objects.all())
# rocniky # rocniky
for ri in range(17, 22): for ri in range(17, 22):
@ -65,8 +66,9 @@ def create_test_data():
p.text_problemu_org = u"<p><strong>Neveřejný</strong> text problému.</p>" p.text_problemu_org = u"<p><strong>Neveřejný</strong> text problému.</p>"
p.save() p.save()
for resi in range(rnd.randint(0, 7)): res_sel = rnd.sample(resitele, min(rnd.randint(3, 10), len(resitele) - 2))
res = Reseni.objects.create(problem = p, resitel = rnd.choice(Resitel.objects.all()), for resitel in res_sel:
res = Reseni.objects.create(problem = p, resitel = resitel,
body = rnd.randint(0, p.body), cislo_body = cs[ci]) body = rnd.randint(0, p.body), cislo_body = cs[ci])
nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(), nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(),