From 200efcbed021711dd43d6f66f514f4bc55af9949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Domes?= Date: Tue, 28 May 2019 23:12:34 +0200 Subject: [PATCH 1/2] =?UTF-8?q?testutils.py:=20oprava=20gitov=C3=BDch=20me?= =?UTF-8?q?rg=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/testutils.py | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index 1ecfc8ff..9cdc842f 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -125,11 +125,7 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): ''' cislo = cislo cisla v rocniku, nikoli objekt Cislo ''' -<<<<<<< HEAD -======= - ->>>>>>> 69f9b54e7b5dbb36070d978d29d90987b1c9212b - # ulohy resene v ci + # ulohy resene v cisle jaka = ["Šachová", "Černá", "Větrná", "Dlouhá", "Křehká", "Rychlá", "Zákeřná", "Fyzikální"] 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_reseni=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) ) p.zadani = " ".join( @@ -180,8 +169,8 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): rnd.choice(jmeno), rnd.choice(kde)] ) - p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) ->>>>>>> 69f9b54e7b5dbb36070d978d29d90987b1c9212b + p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) + p.opravovatele = rnd.sample(organizatori, poc_op) p.save() # reseni ulohy @@ -191,7 +180,6 @@ 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: -<<<<<<< HEAD # problem a resitele přiřadíme později, ManyToManyField # se nedá vyplnit v create() res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)) @@ -201,21 +189,10 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): 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 ) ->>>>>>> 69f9b54e7b5dbb36070d978d29d90987b1c9212b - return + return def gen_soustredeni(): # TODO: vice soustredeni a k nim nahodne podmnoziny organizatoru a ucastniku From cdee8ddfa58aafc42d260672ea57a81149396041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Domes?= Date: Tue, 28 May 2019 23:39:38 +0200 Subject: [PATCH 2/2] =?UTF-8?q?models.py:=20p=C5=99=C3=ADjemce=20je=20OneT?= =?UTF-8?q?oOneField?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seminar/models.py b/seminar/models.py index 0af567b6..8c3a052b 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -198,10 +198,11 @@ class Prijemce(SeminarModelBase): poznamka = models.TextField('neveřejná poznámka', blank=True, help_text='Neveřejná poznámka k příemci čísel (plain text)') - osoba = models.ForeignKey(Osoba, verbose_name='komu', blank=False, null=False, + osoba = models.OneToOneField(Osoba, verbose_name='komu', blank=False, null=False, help_text='Které osobě či na jakou adresu se mají zasílat čísla') # FIXME: možná chceme něco jako vazbu na osobu XOR školu a počet kusů k zaslání + # FIXME: a možná taky posílání na mail a možná taky přes něj chceme posílat i řešitelům def __str__(self): return self.osoba.plne_jmeno()