def getTeamDetails(self, year, team_key):
        team_number = team_key[3:]  # everything after 'frc'

        team = self._parse(
            self.FMS_API_TEAM_DETAILS_URL_PATTERN % (year, team_number),
            FMSAPITeamDetailsParser(year))
        return team
Пример #2
0
    def getTeamDetails(self, year, team_key):
        team_number = team_key[3:]  # everything after 'frc'

        result = self._parse(
            self.FMS_API_TEAM_DETAILS_URL_PATTERN % (year, team_number),
            FMSAPITeamDetailsParser(year))
        if result:
            return result[0]  # (team, districtteam, robot)
        else:
            return None
Пример #3
0
    def getEventTeams(self, event_key):
        year = int(event_key[:4])
        event_code = self._get_event_short(event_key[4:])

        event = Event.get_by_id(event_key)
        parser = FMSAPITeamDetailsParser(year)
        models = []  # will be list of tuples (team, districtteam, robot) model
        for page in range(1, 9):  # Ensure this won't loop forever. 8 pages should be more than enough
            url = self.FMS_API_EVENTTEAM_LIST_URL_PATTERN % (year, self._get_event_short(event_code, event), page)
            result = self._parse(url, parser)
            if result is None:
                break
            partial_models, more_pages = result
            models.extend(partial_models)

            if not more_pages:
                break

        return models
    def getEventTeams(self, event_key):
        year = int(event_key[:4])
        event_code = self._get_event_short(event_key[4:])
        if event_code == 'cmp':  # Don't add cmp teams because FIRST serves all Championship teams under Einstein
            return []

        parser = FMSAPITeamDetailsParser(year)
        models = []  # will be list of tuples (team, districtteam, robot) model
        for page in range(1, 9):  # Ensure this won't loop forever. 8 pages should be more than enough
            url = self.FMS_API_EVENTTEAM_LIST_URL_PATTERN % (year, event_code, page)
            result = self._parse(url, parser)
            if result is None:
                break
            partial_models, more_pages = result
            models.extend(partial_models)

            if not more_pages:
                break

        return models
    def getEventTeams(self, event_key):
        year = int(event_key[:4])
        event_code = self._get_event_short(event_key[4:])

        event = Event.get_by_id(event_key)
        parser = FMSAPITeamDetailsParser(year)
        models = []  # will be list of tuples (team, districtteam, robot) model

        more_pages = True
        page = 1

        while more_pages:
            url = self.FMS_API_EVENTTEAM_LIST_URL_PATTERN % (year, self._get_event_short(event_code, event), page)
            result = self._parse(url, parser)
            if result is None:
                break

            partial_models, more_pages = result
            models.extend(partial_models)

            page = page + 1

        return models