|
@ -125,11 +125,7 @@ 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 |
|
|
''' |
|
|
''' |
|
|
<<<<<<< HEAD |
|
|
# ulohy resene v cisle |
|
|
======= |
|
|
|
|
|
|
|
|
|
|
|
>>>>>>> 69f9b54e7b5dbb36070d978d29d90987b1c9212b |
|
|
|
|
|
# ulohy resene v ci |
|
|
|
|
|
jaka = ["Šachová", "Černá", "Větrná", "Dlouhá", "Křehká", "Rychlá", |
|
|
jaka = ["Šachová", "Černá", "Větrná", "Dlouhá", "Křehká", "Rychlá", |
|
|
"Zákeřná", "Fyzikální"] |
|
|
"Zákeřná", "Fyzikální"] |
|
|
co = ["kostka", "smršť", "díra", "zrada", "toulka", "tyč", |
|
|
co = ["kostka", "smršť", "díra", "zrada", "toulka", "tyč", |
|
@ -164,13 +160,6 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
cislo_zadani=slovnik_cisel[cislo-2], |
|
|
cislo_zadani=slovnik_cisel[cislo-2], |
|
|
cislo_reseni=slovnik_cisel[cislo], |
|
|
cislo_reseni=slovnik_cisel[cislo], |
|
|
cislo_deadline=slovnik_cisel[cislo], |
|
|
cislo_deadline=slovnik_cisel[cislo], |
|
|
<<<<<<< HEAD |
|
|
|
|
|
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.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) |
|
|
|
|
|
p.opravovatele = rnd.sample(organizatori, poc_op) |
|
|
|
|
|
======= |
|
|
|
|
|
max_body = rnd.randint(1, 8) |
|
|
max_body = rnd.randint(1, 8) |
|
|
) |
|
|
) |
|
|
p.zadani = " ".join( |
|
|
p.zadani = " ".join( |
|
@ -181,7 +170,7 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
rnd.choice(kde)] |
|
|
rnd.choice(kde)] |
|
|
) |
|
|
) |
|
|
p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) |
|
|
p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) |
|
|
>>>>>>> 69f9b54e7b5dbb36070d978d29d90987b1c9212b |
|
|
p.opravovatele = rnd.sample(organizatori, poc_op) |
|
|
p.save() |
|
|
p.save() |
|
|
|
|
|
|
|
|
# reseni ulohy |
|
|
# reseni ulohy |
|
@ -191,30 +180,18 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): |
|
|
# (nebo skoro vsechny resitele, pokud jich je mene nez pocet reseni) |
|
|
# (nebo skoro vsechny resitele, pokud jich je mene nez pocet reseni) |
|
|
res_vyber = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2)) |
|
|
res_vyber = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2)) |
|
|
for resitel in res_vyber: |
|
|
for resitel in res_vyber: |
|
|
<<<<<<< HEAD |
|
|
|
|
|
# problem a resitele přiřadíme později, ManyToManyField |
|
|
# problem a resitele přiřadíme později, ManyToManyField |
|
|
# se nedá vyplnit v create() |
|
|
# se nedá vyplnit v create() |
|
|
res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)) |
|
|
res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)) |
|
|
res.resitele = [resitel] |
|
|
res.resitele = [resitel] |
|
|
res.problem = p |
|
|
res.problem = p |
|
|
res.save() |
|
|
res.save() |
|
|
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( |
|
|
hod = Hodnoceni.objects.create( |
|
|
body=rnd.randint(0, p.max_body), |
|
|
body=rnd.randint(0, p.max_body), |
|
|
cislo_body=slovnik_cisel[cislo], |
|
|
cislo_body=slovnik_cisel[cislo], |
|
|
reseni=res, |
|
|
reseni=res, |
|
|
problem=p |
|
|
problem=p |
|
|
) |
|
|
) |
|
|
>>>>>>> 69f9b54e7b5dbb36070d978d29d90987b1c9212b |
|
|
|
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
def gen_soustredeni(): |
|
|
def gen_soustredeni(): |
|
|