mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 01:12:08 +01:00 
			
		
		
		
	[WEI] Prepare WEI 2021
No need to save WEI 2020 data because there weren't any WEI 2020 Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
		@@ -2,11 +2,11 @@
 | 
				
			|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
					# SPDX-License-Identifier: GPL-3.0-or-later
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .base import WEISurvey, WEISurveyInformation, WEISurveyAlgorithm
 | 
					from .base import WEISurvey, WEISurveyInformation, WEISurveyAlgorithm
 | 
				
			||||||
from .wei2020 import WEISurvey2020
 | 
					from .wei2021 import WEISurvey2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__all__ = [
 | 
					__all__ = [
 | 
				
			||||||
    'WEISurvey', 'WEISurveyInformation', 'WEISurveyAlgorithm', 'CurrentSurvey',
 | 
					    'WEISurvey', 'WEISurveyInformation', 'WEISurveyAlgorithm', 'CurrentSurvey',
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CurrentSurvey = WEISurvey2020
 | 
					CurrentSurvey = WEISurvey2021
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,9 +20,9 @@ WORDS = ['Rap', 'Retro', 'DJ', 'Rock', 'Jazz', 'Chansons Populaires', 'Chansons
 | 
				
			|||||||
         'Se lacher', 'Chill', 'Débile', 'Beauf', 'Bon enfant']
 | 
					         'Se lacher', 'Chill', 'Débile', 'Beauf', 'Bon enfant']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WEISurveyForm2020(forms.Form):
 | 
					class WEISurveyForm2021(forms.Form):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Survey form for the year 2020.
 | 
					    Survey form for the year 2021.
 | 
				
			||||||
    Members choose 20 words, from which we calculate the best associated bus.
 | 
					    Members choose 20 words, from which we calculate the best associated bus.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,7 +44,7 @@ class WEISurveyForm2020(forms.Form):
 | 
				
			|||||||
        self.fields["word"].choices = words
 | 
					        self.fields["word"].choices = words
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WEIBusInformation2020(WEIBusInformation):
 | 
					class WEIBusInformation2021(WEIBusInformation):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    For each word, the bus has a score
 | 
					    For each word, the bus has a score
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -54,7 +54,7 @@ class WEIBusInformation2020(WEIBusInformation):
 | 
				
			|||||||
        super().__init__(bus)
 | 
					        super().__init__(bus)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WEISurveyInformation2020(WEISurveyInformation):
 | 
					class WEISurveyInformation2021(WEISurveyInformation):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    We store the id of the selected bus. We store only the name, but is not used in the selection:
 | 
					    We store the id of the selected bus. We store only the name, but is not used in the selection:
 | 
				
			||||||
    that's only for humans that try to read data.
 | 
					    that's only for humans that try to read data.
 | 
				
			||||||
@@ -67,21 +67,21 @@ class WEISurveyInformation2020(WEISurveyInformation):
 | 
				
			|||||||
        super().__init__(registration)
 | 
					        super().__init__(registration)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WEISurvey2020(WEISurvey):
 | 
					class WEISurvey2021(WEISurvey):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Survey for the year 2020.
 | 
					    Survey for the year 2021.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_year(cls):
 | 
					    def get_year(cls):
 | 
				
			||||||
        return 2020
 | 
					        return 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_survey_information_class(cls):
 | 
					    def get_survey_information_class(cls):
 | 
				
			||||||
        return WEISurveyInformation2020
 | 
					        return WEISurveyInformation2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_form_class(self):
 | 
					    def get_form_class(self):
 | 
				
			||||||
        return WEISurveyForm2020
 | 
					        return WEISurveyForm2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def update_form(self, form):
 | 
					    def update_form(self, form):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
@@ -98,7 +98,7 @@ class WEISurvey2020(WEISurvey):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_algorithm_class(cls):
 | 
					    def get_algorithm_class(cls):
 | 
				
			||||||
        return WEISurveyAlgorithm2020
 | 
					        return WEISurveyAlgorithm2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def is_complete(self) -> bool:
 | 
					    def is_complete(self) -> bool:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
@@ -107,20 +107,20 @@ class WEISurvey2020(WEISurvey):
 | 
				
			|||||||
        return self.information.step == 20
 | 
					        return self.information.step == 20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WEISurveyAlgorithm2020(WEISurveyAlgorithm):
 | 
					class WEISurveyAlgorithm2021(WEISurveyAlgorithm):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    The algorithm class for the year 2020.
 | 
					    The algorithm class for the year 2021.
 | 
				
			||||||
    For now, the algorithm is quite simple: the selected bus is the chosen bus.
 | 
					    For now, the algorithm is quite simple: the selected bus is the chosen bus.
 | 
				
			||||||
    TODO: Improve this algorithm.
 | 
					    TODO: Improve this algorithm.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_survey_class(cls):
 | 
					    def get_survey_class(cls):
 | 
				
			||||||
        return WEISurvey2020
 | 
					        return WEISurvey2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_bus_information_class(cls):
 | 
					    def get_bus_information_class(cls):
 | 
				
			||||||
        return WEIBusInformation2020
 | 
					        return WEIBusInformation2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def run_algorithm(self):
 | 
					    def run_algorithm(self):
 | 
				
			||||||
        for registration in self.get_registrations():
 | 
					        for registration in self.get_registrations():
 | 
				
			||||||
		Reference in New Issue
	
	Block a user