|
|
@ -54,7 +54,7 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
#FIXME pridat kontaktni osobu alespon nekde |
|
|
|
skoly.append(zlinska = Skola.objects.create(mesto = 'Zlín', stat='CZ', psc='76001', |
|
|
|
ulice='náměstí T.G. Masaryka 2734-9', nazev='Gymnázium a Střední jazyková škola s právem SJZ', |
|
|
|
kratky_nazev="GaSJŠspSJZ" je_zs=True, je_ss=True)) |
|
|
|
kratky_nazev="GaSJŠspSJZ", je_zs=True, je_ss=True)) |
|
|
|
|
|
|
|
# osoby |
|
|
|
jmena_m = ['Aleš', 'Tomáš', 'Martin', 'Jakub', 'Petr', 'Lukáš', 'Cyril', 'Pavel Karel'] |
|
|
@ -65,12 +65,12 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
'Suchá', 'Lovelace', 'Holcová', 'Rui'] |
|
|
|
prezdivka = ['Kaki', 'Hurdur', 'Maracuja', 'Bobbo', None, None, None, None, None, None, None, |
|
|
|
'Riki', 'Sapa', None, '', '---', 'Koko'] |
|
|
|
name = [unidecode.unidecode(n) for n in jmena_m, jmena_f] |
|
|
|
domain = ['example.com', 'dolujeme.eu', 'mff.cuni.cz', 'strcprstskrzkrk.cz', 'british.co.uk', |
|
|
|
'splachni.to', 'haha.org'] |
|
|
|
seznam_ulic = ['Krátká', 'Vlhká', 'Jungmanova', '17. listopadu', '4. října', 'Roztocká', 'Forstova', |
|
|
|
'Generála Františka Janouška', 'Náměstí Války', 'Svratecké náměstí', 'Zelená lhota', |
|
|
|
'Z Plynu', 'K Jezeru', 'U Kocourkova', 'Uštěpačná', 'Ostrorepská', 'Zubří'] |
|
|
|
seznam_ulic = ['Krátká', 'Vlhká', 'Jungmanova', '17. listopadu', '4. října', 'Roztocká', |
|
|
|
'Forstova', 'Generála Františka Janouška', 'Náměstí Války', 'Svratecké náměstí', |
|
|
|
'Zelená lhota', 'Z Plynu', 'K Jezeru', 'U Kocourkova', 'Uštěpačná', 'Ostrorepská', |
|
|
|
'Zubří'] |
|
|
|
seznam_mest = ['Praha', 'Brno', 'Ostrava', 'Horní Jelení', 'Dolní Zábrdovice', 'Prdelkov', |
|
|
|
'Stará myslivna', 'Kocourkov', 'Šalingrad', 'Medvědí hora', 'Basilej', |
|
|
|
'Unterschiedlich', 'Old York', 'Lancastershire', 'Vóloďháza'] |
|
|
@ -81,7 +81,7 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
jmeno = rnd.choice([jmena_m, jmena_f][pohlavi]) |
|
|
|
prijmeni = rnd.choice([prijmeni_m, prijmeni_f][pohlavi]) |
|
|
|
prezdivka = rnd.choice(prezdivka) |
|
|
|
email = "@".join([rnd.choice(name), rnd.choice(domain)]) |
|
|
|
email = "@".join([unidecode.unidecode(jmeno), rnd.choice(domain)]) |
|
|
|
telefon = [rnd.choice([k for k in range(10)]) for i in range(10)] |
|
|
|
narozeni = datetime.date(rnd.randint(1980, 2020), rnd.randint(1, 12), rnd.randint(1, 28)) |
|
|
|
ulic = rnd.choice([seznam_ulic]) |
|
|
@ -93,7 +93,7 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
pohlavi_muz = pohlavi, email = email, telefon = telefon, datum_narozeni = narozeni, |
|
|
|
ulice = ulice, mesto = mesto, psc = psc, |
|
|
|
datum_registrace = datetime.date(rnd.randint(2019, 2029), rnd.randint(1, 12), |
|
|
|
rnd.randint(1, 28))) |
|
|
|
rnd.randint(1, 28)))) |
|
|
|
#TODO pridat foto male a velke. Jak? |
|
|
|
|
|
|
|
# resitele a organizatori |
|
|
@ -102,9 +102,10 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
organizatori = [] |
|
|
|
for os in osoby: |
|
|
|
rand = rnd.randint(0, 8) |
|
|
|
if not (rand % 8 = 0): |
|
|
|
if not (rand % 8 == 0): |
|
|
|
resitele.append(Resitel.objects.create(osoba = os, skola = rnd.choice([skoly]), |
|
|
|
rok_maturity = rnd.randint(2019, 2029), zasilat = rnd.choice(Resitel.ZASILAT_CHOICES))) |
|
|
|
rok_maturity = rnd.randint(2019, 2029), |
|
|
|
zasilat = rnd.choice(Resitel.ZASILAT_CHOICES))) |
|
|
|
else: |
|
|
|
pusobnost = rnd.randint(1, last_rocnik) |
|
|
|
od = 1993 + last_rocnik - pusobnost |
|
|
@ -126,13 +127,14 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
for ci in range(1, cisel + 1): |
|
|
|
if ci >= 3: |
|
|
|
vydano = datetime.date(r.prvni_rok, ci + 6, rnd.randint(1, 28)) |
|
|
|
deadline = datetime.date(r.prvni_rok, ci + 8, rnd.randint(1, 28) |
|
|
|
deadline = datetime.date(r.prvni_rok, ci + 8, rnd.randint(1, 28)) |
|
|
|
else: |
|
|
|
vydano = datetime.date(r.druhy_rok, ci - 3, rnd.randint(1, 28) |
|
|
|
vydano = datetime.date(r.druhy_rok, ci - 3, rnd.randint(1, 28)) |
|
|
|
# posledni 2 cisla v rocniku nemaji deadline |
|
|
|
if ci + 2 > cisel: |
|
|
|
deadline = datetime.date(r.druhy_rok, ci - 1, rnd.randint(1, 28) |
|
|
|
else: None |
|
|
|
if (ci + 2 > cisel): |
|
|
|
deadline = datetime.date(r.druhy_rok, ci - 1, rnd.randint(1, 28)) |
|
|
|
else: |
|
|
|
deadline = None |
|
|
|
cislo = Cislo.objects.create(rocnik = r, cislo = str(ci), datum_vydani=vydano, |
|
|
|
datum_deadline=deadline, verejne_db=True) |
|
|
|
slovnik_cisel[ci] = cislo |
|
|
@ -142,24 +144,24 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
# TODO: nagenerovat starsim rocnikum pohadku |
|
|
|
|
|
|
|
# problemy resene v ci |
|
|
|
seq='#ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
|
|
|
if ci >= 3: |
|
|
|
for pi in range(1, ((size + 1) // 2) + 1): |
|
|
|
p = Problem.objects.create(autor = rnd.choice(orgs), cislo_zadani=cs[ci-2], |
|
|
|
cislo_reseni=cs[ci], opravovatel = rnd.choice(orgs), kod = str(pi), |
|
|
|
nazev = u'Dummy úloha %s-%s' % (seq[ci], seq[pi]), |
|
|
|
stav = Problem.STAV_ZADANY, typ = Problem.TYP_ULOHA, body = rnd.randint(1, 5)) |
|
|
|
p.text_problemu = (u"<p>Text problému <strong>%s.%s %s</strong><em> [id %d]</em> za %d body.</p>" % |
|
|
|
(p.cislo_zadani.kod(), p.kod, p.nazev, p.id, p.body)) |
|
|
|
p.text_problemu_org = u"<p><strong>Neveřejný</strong> text problému.</p>" |
|
|
|
p.save() |
|
|
|
|
|
|
|
poc_reseni = rnd.randint(size // 2, size * 2) |
|
|
|
res_sel = rnd.sample(resitele, min(poc_reseni, 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]) |
|
|
|
|
|
|
|
# seq='#ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
|
|
|
# if ci >= 3: |
|
|
|
# for pi in range(1, ((size + 1) // 2) + 1): |
|
|
|
# p = Problem.objects.create(autor = rnd.choice(orgs), cislo_zadani=cs[ci-2], |
|
|
|
# cislo_reseni=cs[ci], opravovatel = rnd.choice(orgs), kod = str(pi), |
|
|
|
# nazev = u'Dummy úloha %s-%s' % (seq[ci], seq[pi]), |
|
|
|
# stav = Problem.STAV_ZADANY, typ = Problem.TYP_ULOHA, body = rnd.randint(1, 5)) |
|
|
|
# p.text_problemu = (u"<p>Text problému <strong>%s.%s %s</strong><em> [id %d]</em> za %d body.</p>" % |
|
|
|
# (p.cislo_zadani.kod(), p.kod, p.nazev, p.id, p.body)) |
|
|
|
# p.text_problemu_org = u"<p><strong>Neveřejný</strong> text problému.</p>" |
|
|
|
# p.save() |
|
|
|
# |
|
|
|
# poc_reseni = rnd.randint(size // 2, size * 2) |
|
|
|
# res_sel = rnd.sample(resitele, min(poc_reseni, 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]) |
|
|
|
# |
|
|
|
# TODO: nahodne nagenerovat problemum reseni a prilohy reseni, hodnoceni |
|
|
|
|
|
|
|
|
|
|
|