From 7c077ed9d5eac83eada517da467ce53b7b86a750 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Tue, 24 Mar 2015 01:10:36 +0100 Subject: [PATCH] Update generovani testovacich dat - resitele uz nemuzou odevzdat vice reseni do jednoho cisla --- seminar/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seminar/tests.py b/seminar/tests.py index 7a83ede3..aa3753f4 100644 --- a/seminar/tests.py +++ b/seminar/tests.py @@ -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), 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) + resitele = list(Resitel.objects.all()) # rocniky for ri in range(17, 22): @@ -65,8 +66,9 @@ def create_test_data(): p.text_problemu_org = u"

Neveřejný text problému.

" p.save() - for resi in range(rnd.randint(0, 7)): - res = Reseni.objects.create(problem = p, resitel = rnd.choice(Resitel.objects.all()), + res_sel = rnd.sample(resitele, min(rnd.randint(3, 10), len(resitele) - 2)) + for resitel in res_sel: + res = Reseni.objects.create(problem = p, resitel = resitel, body = rnd.randint(0, p.body), cislo_body = cs[ci]) nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(),