mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 18:08:21 +02:00
more tests
This commit is contained in:
@ -1,14 +1,11 @@
|
||||
# Copyright (C) 2018-2023 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# import time
|
||||
from functools import lru_cache
|
||||
# from random import Random
|
||||
|
||||
from django import forms
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
# from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .base import WEISurvey, WEISurveyInformation, WEISurveyAlgorithm, WEIBusInformation
|
||||
from ...models import WEIMembership
|
||||
@ -48,12 +45,6 @@ class WEISurveyForm2023(forms.Form):
|
||||
"""
|
||||
information = WEISurveyInformation2023(registration)
|
||||
|
||||
# if self.data:
|
||||
# for question in WORDS:
|
||||
# self.fields[question].choices = [answer for answer in WORDS[question][1]]
|
||||
# if self.is_valid():
|
||||
# return
|
||||
|
||||
question = information.questions[information.step]
|
||||
self.fields[question] = forms.ChoiceField(
|
||||
label=WORDS[question][0] + question,
|
||||
@ -86,14 +77,6 @@ class WEISurveyInformation2023(WEISurveyInformation):
|
||||
questions = list(WORDS.keys())
|
||||
|
||||
def __init__(self, registration):
|
||||
# print(hasattr(self,"questions"))
|
||||
# if not hasattr(self, "questions"):
|
||||
# rng = Random(int(1000 * time.time()))
|
||||
# questions = list(WORDS.keys())
|
||||
# rng.shuffle(questions)
|
||||
# setattr(self, "questions", questions)
|
||||
# print(questions)
|
||||
|
||||
for question in WORDS:
|
||||
setattr(self, str(question), None)
|
||||
super().__init__(registration)
|
||||
@ -143,15 +126,6 @@ class WEISurvey2023(WEISurvey):
|
||||
return False
|
||||
return True
|
||||
|
||||
# @classmethod
|
||||
# @lru_cache()
|
||||
# def word_mean(cls, word):
|
||||
# """
|
||||
# Calculate the mid-score given by all buses.
|
||||
# """
|
||||
# buses = cls.get_algorithm_class().get_buses()
|
||||
# return sum([cls.get_algorithm_class().get_bus_information(bus).scores[word] for bus in buses]) / buses.count()
|
||||
|
||||
@lru_cache()
|
||||
def score(self, bus):
|
||||
if not self.is_complete():
|
||||
@ -176,7 +150,6 @@ class WEISurvey2023(WEISurvey):
|
||||
|
||||
@classmethod
|
||||
def clear_cache(cls):
|
||||
# cls.word_mean.cache_clear()
|
||||
return super().clear_cache()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user