mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
[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 = []
|
||||
for _ignored in range(information.step + 1):
|
||||
# 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]
|
||||
if self.data:
|
||||
self.fields["word"].choices = [(w, w) for w in WORDS]
|
||||
|
Loading…
Reference in New Issue
Block a user