示例#1
0
    def AssignTeam(self, team_id: int, station: str):
        team_id = int(team_id)
        if station not in self.alliance_stations:
            return "Invalid alliance station"

        dsconn = self.alliance_stations[station].driverstation_connection

        if dsconn != None and dsconn.team_id == team_id:
            return None

        if dsconn != None:
            dsconn.Close()
            self.alliance_stations[station].team = None
            self.alliance_stations[station].driverstation_connection = None

        if team_id == 0:
            self.alliance_stations[station].team = None
            return None

        team = Team()
        team.id = team_id
        self.alliance_stations[station].team = team

        notice(f"Team {team_id} has been assigned to station {station}")
        return None
示例#2
0
 def __fetch_to_object(self, fetchresult, return_one=False):
     liste = []
     try:
         if len(fetchresult) > 0:
             for fetch in fetchresult:
                 obj = Team(fetch[0],
                            fetch[2],
                            fetch[3])
                 obj.id = fetch[1]
                 liste.append(obj)
             return liste if not return_one else liste[0]
         else:
             return None
     except Exception as ex:
         DAOException(self, ex)