|
|
@ -34,7 +34,7 @@ def gen_osoby(size): |
|
|
|
'Unterschiedlich', 'Old York', 'Lancastershire', 'Vóloďháza'] |
|
|
|
|
|
|
|
osoby = [] |
|
|
|
for i in range(3 * size): |
|
|
|
for i in range(3 * size): # 3 je náhodná konstanta, size je použité na víc místech a říká, jak velká asi chceme testovací data |
|
|
|
pohlavi = rnd.randint(0,1) |
|
|
|
jmeno = rnd.choice([jmena_m, jmena_f][pohlavi]) |
|
|
|
prijmeni = rnd.choice([prijmeni_m, prijmeni_f][pohlavi]) |
|
|
@ -170,7 +170,18 @@ def gen_ulohy_do_cisla(cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
|
cislo_body=slovnik_cisel[cislo], reseni=res, problem=p) |
|
|
|
return |
|
|
|
|
|
|
|
def gen_soustredeni(): |
|
|
|
# TODO: vice soustredeni a k nim nahodne podmnoziny organizatoru a ucastniku |
|
|
|
sous = Soustredeni.objects.create(rocnik=Rocnik.objects.first(), verejne_db=True, |
|
|
|
misto=u'Někde', datum_zacatku=datetime.date(2000, 11, 23), |
|
|
|
datum_konce=datetime.date(2000, 11, 27)) |
|
|
|
|
|
|
|
for res in rnd.sample(resitele, 6): |
|
|
|
Soustredeni_Ucastnici.objects.create(resitel=res, soustredeni=sous) |
|
|
|
sous.save() |
|
|
|
|
|
|
|
nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(), |
|
|
|
aktualni_cislo = Cislo.objects.all()[1]) |
|
|
|
|
|
|
|
@transaction.atomic |
|
|
|
def create_test_data(size = 6, rnd = None): |
|
|
@ -299,16 +310,5 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
# TODO: nahodne nagenerovat problemum reseni a prilohy reseni, hodnoceni |
|
|
|
|
|
|
|
|
|
|
|
# TODO: vice soustredeni a k nim nahodne podmnoziny organizatoru a ucastniku |
|
|
|
sous = Soustredeni.objects.create(rocnik=Rocnik.objects.first(), verejne_db=True, |
|
|
|
misto=u'Někde', datum_zacatku=datetime.date(2000, 11, 23), |
|
|
|
datum_konce=datetime.date(2000, 11, 27)) |
|
|
|
|
|
|
|
for res in rnd.sample(resitele, 6): |
|
|
|
Soustredeni_Ucastnici.objects.create(resitel=res, soustredeni=sous) |
|
|
|
sous.save() |
|
|
|
|
|
|
|
nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(), |
|
|
|
aktualni_cislo = Cislo.objects.all()[1]) |
|
|
|
|
|
|
|
|
|
|
|