mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-02-24 17:11:18 +00:00
Compare commits
2 Commits
5bf6a5501d
...
f25eb1d2c5
Author | SHA1 | Date | |
---|---|---|---|
f25eb1d2c5 | |||
a2a749e1ca |
@ -40,15 +40,17 @@ class WEISurveyForm2021(forms.Form):
|
|||||||
if not information.seed:
|
if not information.seed:
|
||||||
information.seed = int(1000 * time.time())
|
information.seed = int(1000 * time.time())
|
||||||
information.save(registration)
|
information.save(registration)
|
||||||
|
registration._force_save = True
|
||||||
registration.save()
|
registration.save()
|
||||||
|
|
||||||
rng = Random(information.seed)
|
rng = Random(information.seed)
|
||||||
|
|
||||||
words = []
|
|
||||||
for _ignored in range(information.step + 1):
|
|
||||||
# Generate N times words
|
|
||||||
words = None
|
words = None
|
||||||
preferred_words = {bus: [word for word in WORDS if WEIBusInformation2021(bus).scores[word] >= 50]
|
# 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()}
|
for bus in WEISurveyAlgorithm2021.get_buses()}
|
||||||
while words is None or len(set(words)) != len(words):
|
while words is None or len(set(words)) != len(words):
|
||||||
# Ensure that there is no the same word 2 times
|
# Ensure that there is no the same word 2 times
|
||||||
|
@ -487,9 +487,13 @@ class WEIRegister1AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
|
|
||||||
def get_sample_object(self):
|
def get_sample_object(self):
|
||||||
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
||||||
|
if "myself" in self.request.path:
|
||||||
|
user = self.request.user
|
||||||
|
else:
|
||||||
|
user = User.objects.get(username="note")
|
||||||
return WEIRegistration(
|
return WEIRegistration(
|
||||||
wei=wei,
|
wei=wei,
|
||||||
user=self.request.user,
|
user=user,
|
||||||
first_year=True,
|
first_year=True,
|
||||||
birth_date="1970-01-01",
|
birth_date="1970-01-01",
|
||||||
gender="No",
|
gender="No",
|
||||||
@ -555,9 +559,13 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
|
|
||||||
def get_sample_object(self):
|
def get_sample_object(self):
|
||||||
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
||||||
|
if "myself" in self.request.path:
|
||||||
|
user = self.request.user
|
||||||
|
else:
|
||||||
|
user = User.objects.get(username="note")
|
||||||
return WEIRegistration(
|
return WEIRegistration(
|
||||||
wei=wei,
|
wei=wei,
|
||||||
user=self.request.user,
|
user=user,
|
||||||
first_year=True,
|
first_year=True,
|
||||||
birth_date="1970-01-01",
|
birth_date="1970-01-01",
|
||||||
gender="No",
|
gender="No",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user