mirror of https://gitlab.crans.org/bde/nk20
[WEI] Choose one word per bus in the survey
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
9930c48253
commit
9523b5f05f
|
@ -47,7 +47,13 @@ class WEISurveyForm2021(forms.Form):
|
||||||
words = []
|
words = []
|
||||||
for _ignored in range(information.step + 1):
|
for _ignored in range(information.step + 1):
|
||||||
# Generate N times words
|
# Generate N times words
|
||||||
words = [rng.choice(WORDS) for _ignored2 in range(10)]
|
words = None
|
||||||
|
preferred_words = {bus: [word for word in WORDS if WEIBusInformation2021(bus).scores[word] >= 50]
|
||||||
|
for bus in WEISurveyAlgorithm2021.get_buses()}
|
||||||
|
while words is None or len(set(words)) != len(words):
|
||||||
|
# Ensure that there is no the same word 2 times
|
||||||
|
words = [rng.choice(words) for _ignored2, words in preferred_words.items()]
|
||||||
|
rng.shuffle(words)
|
||||||
words = [(w, w) for w in words]
|
words = [(w, w) for w in words]
|
||||||
if self.data:
|
if self.data:
|
||||||
self.fields["word"].choices = [(w, w) for w in WORDS]
|
self.fields["word"].choices = [(w, w) for w in WORDS]
|
||||||
|
|
Loading…
Reference in New Issue