|
@ -43,8 +43,8 @@ def gen_soustredeni( |
|
|
def gen_konfery( |
|
|
def gen_konfery( |
|
|
size: int, |
|
|
size: int, |
|
|
organizatori: Sequence[pm.Organizator], |
|
|
organizatori: Sequence[pm.Organizator], |
|
|
resitele: Sequence[pm.Resitel], |
|
|
|
|
|
soustredeni: Sequence[Soustredeni], |
|
|
soustredeni: Sequence[Soustredeni], |
|
|
|
|
|
resitele: Sequence[pm.Resitel] = None, |
|
|
rnd: random.Random = None, |
|
|
rnd: random.Random = None, |
|
|
) -> Sequence[Konfera]: |
|
|
) -> Sequence[Konfera]: |
|
|
logger.info('Generuji konfery (size={})...'.format(size)) |
|
|
logger.info('Generuji konfery (size={})...'.format(size)) |
|
@ -61,7 +61,7 @@ def gen_konfery( |
|
|
garant=rnd.choice(organizatori), |
|
|
garant=rnd.choice(organizatori), |
|
|
soustredeni=rnd.choice(soustredeni), |
|
|
soustredeni=rnd.choice(soustredeni), |
|
|
typ_prezentace=rnd.choice(['veletrh', 'prezentace'])) |
|
|
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))) |
|
|
ucastnici = rnd.sample(ucastnici_sous, min(len(ucastnici_sous), rnd.randint(3, 6))) |
|
|
konfera.ucastnici.set(ucastnici) |
|
|
konfera.ucastnici.set(ucastnici) |
|
|
konfera.save() |
|
|
konfera.save() |
|
|