Example #1
0
    def __init__(self, request):
        super().__init__(request)
        self.validation_table = {
            'base_table_invalid': {'_state', 'event_rotation_detail'},
            'base_form_invalid': {
                '_state', 'id', 'event_school_ids', 'event_team_number',
                'event_create_time'
            },
        }

        self.assoc_class_activity = EventActivity
        self.assoc_class_team = Team
        self.assoc_class_school = School
        self.assoc_class_team_link = EventTeam
        self.assoc_class_tag = EventTag
        self.assoc_class_summary = Summary
        self.assoc_class_season = Season

        self.event_race_tag = [
            EventTag.DEFAULT_EVENT_TAGS +
            ' {}'.format(MiscFunctions.getAlphabet(i)) for i in range(2)
        ]
        self.event_team_name_suffix = [
            Team.TEAM_NAME_SUFFIX + ' {}'.format(MiscFunctions.getAlphabet(i))
            for i in range(2)
        ]
        self.event_activity_type = EventActivity.ACTIVITY_TYPE_RACE
    def __init__(self, request):
        self.event_type = 'fleet race'
        super().__init__(request)
        self.assoc_class_activity = EventActivity
        self.assoc_class_team = Team
        self.assoc_class_school = School
        self.assoc_class_team_link = EventTeam
        self.assoc_class_tag = EventTag
        self.assoc_class_type = EventType
        self.assoc_class_summary = Summary
        self.assoc_class_season = Season

        self.event_race_tag = [
            EventTag.DEFAULT_EVENT_TAGS +
            ' {}'.format(MiscFunctions.getAlphabet(i)) for i in range(2)
        ]
        self.event_team_name_suffix = [
            Team.TEAM_NAME_SUFFIX + ' {}'.format(MiscFunctions.getAlphabet(i))
            for i in range(2)
        ]
        self.event_activity_type = EventActivity.ACTIVITY_TYPE_RACE
Example #3
0
 def updateEventTeams(self, school_ids, action):
     event_tags = EventTagAPI(
         self.request).filterSelf(event_tag_event_id=self.event.id)
     if action == AuthenticationActionType.ADD:
         schools = SchoolAPI(self.request).filterSelf(id__in=school_ids)
         for school in schools:
             for idx, tag in enumerate(event_tags):
                 team_name = '{} {} {}'.format(
                     school.school_default_team_name, Team.TEAM_NAME_SUFFIX,
                     MiscFunctions.getAlphabet(idx))
                 TeamAPI(self.request).createSelf(team_name=team_name,
                                                  team_school=school.id,
                                                  team_status="active",
                                                  team_tag_id=tag.id)
     elif action == AuthenticationActionType.DELETE:
         TeamAPI(self.request).deleteSelf(
             legacy=False,
             team_tag_id__in=[e.id for e in event_tags],
             team_school__in=school_ids).delete()