1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

[WEI] Fix permission check to register new accounts to users

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
2021-09-05 17:12:41 +02:00
parent 5bf6a5501d
commit a2a749e1ca
2 changed files with 13 additions and 12 deletions

View File

@ -44,16 +44,17 @@ class WEISurveyForm2021(forms.Form):
rng = Random(information.seed)
words = []
for _ignored in range(information.step + 1):
# Generate N times words
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 = None
# Update seed
rng.randint(0, information.step)
preferred_words = {bus: [word for word in WORDS if bus.size > 0
and 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]