From d952ab13a5c8bbd39b1c660400c4cd6f0ba9b81c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Fri, 2 Aug 2024 20:17:31 +0200 Subject: [PATCH] =?UTF-8?q?Generov=C3=A1n=C3=AD=20konfer=20s=20konkr=C3=A9?= =?UTF-8?q?tn=C3=ADmi=20=C5=99e=C5=A1iteli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/testutils.py | 2 +- soustredeni/testutils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index b7bd61e2..18bbbe2e 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -840,7 +840,7 @@ def create_test_data(size = 6, rnd = None): soustredeni = gen_soustredeni(size, resitele, organizatori, rnd=rnd) #generování konfer - konfery = gen_konfery(size, organizatori, resitele, soustredeni, rnd=rnd) + konfery = gen_konfery(size, organizatori, soustredeni, rnd=rnd) # vytvoreni pdf ke korekturam create_test_pdf(rnd, organizatori) diff --git a/soustredeni/testutils.py b/soustredeni/testutils.py index 6e406530..52e81d1c 100644 --- a/soustredeni/testutils.py +++ b/soustredeni/testutils.py @@ -43,8 +43,8 @@ def gen_soustredeni( def gen_konfery( size: int, organizatori: Sequence[pm.Organizator], - resitele: Sequence[pm.Resitel], soustredeni: Sequence[Soustredeni], + resitele: Sequence[pm.Resitel] = None, rnd: random.Random = None, ) -> Sequence[Konfera]: logger.info('Generuji konfery (size={})...'.format(size)) @@ -61,7 +61,7 @@ def gen_konfery( garant=rnd.choice(organizatori), soustredeni=rnd.choice(soustredeni), typ_prezentace=rnd.choice(['veletrh', 'prezentace'])) - ucastnici_sous = list(konfera.soustredeni.ucastnici.all()) + ucastnici_sous = resitele if resitele else list(konfera.soustredeni.ucastnici.all()) ucastnici = rnd.sample(ucastnici_sous, min(len(ucastnici_sous), rnd.randint(3, 6))) konfera.ucastnici.set(ucastnici) konfera.save()