|
|
@ -116,7 +116,10 @@ def gen_organizatori(rnd, osoby, last_rocnik, users): |
|
|
|
return organizatori |
|
|
|
|
|
|
|
def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
|
'''cislo = cislo cisla v rocniku, nikoli objekt Cislo ''' |
|
|
|
''' |
|
|
|
cislo = cislo cisla v rocniku, nikoli objekt Cislo |
|
|
|
''' |
|
|
|
|
|
|
|
# ulohy resene v ci |
|
|
|
jaka = ["Šachová", "Černá", "Větrná", "Dlouhá", "Křehká", "Rychlá", |
|
|
|
"Zákeřná", "Fyzikální"] |
|
|
@ -152,8 +155,13 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
|
cislo_reseni=slovnik_cisel[cislo], |
|
|
|
cislo_deadline=slovnik_cisel[cislo], |
|
|
|
max_body = rnd.randint(1, 8)) |
|
|
|
p.zadani = " ".join([rnd.choice(sloveso), rnd.choice(koho), |
|
|
|
rnd.choice(ceho), rnd.choice(jmeno), rnd.choice(kde)]) |
|
|
|
p.zadani = " ".join( |
|
|
|
[rnd.choice(sloveso), |
|
|
|
rnd.choice(koho), |
|
|
|
rnd.choice(ceho), |
|
|
|
rnd.choice(jmeno), |
|
|
|
rnd.choice(kde)] |
|
|
|
) |
|
|
|
p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) |
|
|
|
p.save() |
|
|
|
|
|
|
@ -164,11 +172,17 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
|
# (nebo skoro vsechny resitele, pokud jich je mene nez pocet reseni) |
|
|
|
res_vyber = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2)) |
|
|
|
for resitel in res_vyber: |
|
|
|
res = Reseni.objects.create(problem = p, |
|
|
|
resitele=[resitel], |
|
|
|
forma=rnd.choice(Reseni.FORMA_CHOICES)) |
|
|
|
hod = Hodnoceni.objects.create(body=rnd.randint(0, p.max_body), |
|
|
|
cislo_body=slovnik_cisel[cislo], reseni=res, problem=p) |
|
|
|
res = Reseni.objects.create( |
|
|
|
problem = p, |
|
|
|
resitele=[resitel], |
|
|
|
forma=rnd.choice(Reseni.FORMA_CHOICES) |
|
|
|
) |
|
|
|
hod = Hodnoceni.objects.create( |
|
|
|
body=rnd.randint(0, p.max_body), |
|
|
|
cislo_body=slovnik_cisel[cislo], |
|
|
|
reseni=res, |
|
|
|
problem=p |
|
|
|
) |
|
|
|
return |
|
|
|
|
|
|
|
def gen_soustredeni(): |
|
|
|