diff --git a/seminar/testutils.py b/seminar/testutils.py index 9aec9eba..c8d02316 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -270,9 +270,12 @@ def gen_ulohy_do_cisla(rnd, organizatori, resitele, rocnik_cisla, rocniky, size) #print("Generuji {}-té řešení".format(ri)) if rnd.randint(1, 10) == 6: # cca desetina řešení od více řešitelů - res_vyber = rnd.sample(resitele_cisla, rnd.randint(2, 5)) + res_vyber = rnd.sample(resitele_cisla, + rnd.randint(2, 5)) else: res_vyber = rnd.sample(resitele_cisla, 1) + if resitele[0] in res_vyber: + res_vyber.remove(resitele[0]) res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)[0]) # problem a resitele přiřadíme později, ManyToManyField # se nedá vyplnit v create() @@ -407,7 +410,8 @@ def gen_temata(rnd, rocniky, rocnik_cisla, organizatori): poc_oboru = rnd.randint(1, 2) rocnik_temata = [] - # Věříme, že rocnik_cisla je pole polí čísel podle ročníků, tak si necháme dát vždycky jeden ročník a k němu příslušná čísla. + # Věříme, že rocnik_cisla je pole polí čísel podle ročníků, tak si necháme dát + # vždycky jeden ročník a k němu příslušná čísla. for rocnik, cisla in zip(rocniky, rocnik_cisla): kod = 1 letosni_temata = []