Beispiel #1
0
    def _process_request(self, request, event_key):
        team_keys = JSONTeamListParser.parse(request.body)
        event = Event.get_by_id(event_key)

        event_teams = []
        for team_key in team_keys:
            if Team.get_by_id(
                    team_key
            ):  # Don't create EventTeams for teams that don't exist
                event_teams.append(
                    EventTeam(id=event.key.id() + '_{}'.format(team_key),
                              event=event.key,
                              team=ndb.Key(Team, team_key),
                              year=event.year))

        # delete old eventteams
        old_eventteam_keys = EventTeam.query(
            EventTeam.event == event.key).fetch(None, keys_only=True)
        to_delete = set(old_eventteam_keys).difference(
            set([et.key for et in event_teams]))
        EventTeamManipulator.delete_keys(to_delete)

        EventTeamManipulator.createOrUpdate(event_teams)

        self.response.out.write(
            json.dumps({'Success': "Event teams successfully updated"}))
    def get(self, event_key):
        df = DatafeedFMSAPI('v2.0')
        event = Event.get_by_id(event_key)

        models = df.getEventTeams(event_key)
        teams = []
        district_teams = []
        robots = []
        for group in models:
            # models is a list of tuples (team, districtTeam, robot)
            if isinstance(group[0], Team):
                teams.append(group[0])
            if isinstance(group[1], DistrictTeam):
                district_teams.append(group[1])
            if isinstance(group[2], Robot):
                robots.append(group[2])

        # Write new models
        teams = TeamManipulator.createOrUpdate(teams)
        district_teams = DistrictTeamManipulator.createOrUpdate(district_teams)
        robots = RobotManipulator.createOrUpdate(robots)

        if not teams:
            # No teams found registered for this event
            teams = []

        # Build EventTeams
        event_teams = [
            EventTeam(id=event.key_name + "_" + team.key_name,
                      event=event.key,
                      team=team.key,
                      year=event.year) for team in teams
        ]

        # Delete eventteams of teams that are no longer registered
        if event.future:
            existing_event_team_keys = set(
                EventTeam.query(EventTeam.event == event.key).fetch(
                    1000, keys_only=True))
            event_team_keys = set([et.key for et in event_teams])
            et_keys_to_delete = existing_event_team_keys.difference(
                event_team_keys)
            EventTeamManipulator.delete_keys(et_keys_to_delete)

        event_teams = EventTeamManipulator.createOrUpdate(event_teams)
        if type(event_teams) is not list:
            event_teams = [event_teams]

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }

        path = os.path.join(
            os.path.dirname(__file__),
            '../templates/datafeeds/usfirst_event_details_get.html')
        self.response.out.write(template.render(path, template_values))
Beispiel #3
0
    def get(self, event_key):
        self._require_admin()
        event = Event.get_by_id(event_key)
        if not event:
            self.abort(404)
            return
        existing_event_team_keys = set(EventTeam.query(EventTeam.event == event.key).fetch(1000, keys_only=True))
        EventTeamManipulator.delete_keys(existing_event_team_keys)

        self.response.out.write("Deleted {} EventTeams from {}".format(len(existing_event_team_keys), event_key))
    def get(self, year, first_eid):
        df = DatafeedUsfirst()
        df_legacy = DatafeedUsfirstLegacy()

        event = df.getEventDetails(first_eid)
        if not event:
            logging.warning("getEventDetails with DatafeedUsfirst for event id {} failed. Retrying with DatafeedUsfirstLegacy.".format(first_eid))
            event = df_legacy.getEventDetails(int(year), first_eid)

        if self.request.get('event_district_enum'):
            event.event_district_enum = int(self.request.get('event_district_enum'))
        event = EventManipulator.createOrUpdate(event)

        teams = df.getEventTeams(int(year), first_eid)
        if not teams:
            logging.warning("getEventTeams with DatafeedUsfirst for event id {} failed. Retrying with DatafeedUsfirstLegacy.".format(first_eid))
            teams = df_legacy.getEventTeams(int(year), first_eid)
            if not teams:
                logging.warning("getEventTeams with DatafeedUsfirstLegacy for event id {} failed.".format(first_eid))
                teams = []

        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            if type(teams) is not list:
                teams = [teams]

            event_teams = [EventTeam(
                id=event.key.id() + "_" + team.key.id(),
                event=event.key,
                team=team.key,
                year=event.year)
                for team in teams]

            # Delete eventteams of teams that unregister from an event
            if event.future:
                existing_event_team_keys = set(EventTeam.query(EventTeam.event == event.key).fetch(1000, keys_only=True))
                event_team_keys = set([et.key for et in event_teams])
                et_keys_to_delete = existing_event_team_keys.difference(event_team_keys)
                EventTeamManipulator.delete_keys(et_keys_to_delete)

            event_teams = EventTeamManipulator.createOrUpdate(event_teams)
            if type(event_teams) is not list:
                event_teams = [event_teams]
        else:
            event_teams = []

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_details_get.html')
        self.response.out.write(template.render(path, template_values))
Beispiel #5
0
    def get(self, event_key):
        event = Event.get_by_id(event_key)
        event_teams = EventTeam.query(EventTeam.event==event.key).fetch()
        for event_team in event_teams:
            status = EventTeamStatusHelper.generate_team_at_event_status(event_team.team.id(), event)
            event_team.status = status
            FirebasePusher.update_event_team_status(event_key, event_team.team.id(), status)
        EventTeamManipulator.createOrUpdate(event_teams)

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            self.response.out.write("Finished calculating event team statuses for: {}".format(event_key))
    def get(self, event_key):
        event = Event.get_by_id(event_key)
        event_teams = EventTeam.query(EventTeam.event==event.key).fetch()
        for event_team in event_teams:
            status = EventTeamStatusHelper.generate_team_at_event_status(event_team.team.id(), event)
            event_team.status = status
            FirebasePusher.update_event_team_status(event_key, event_team.team.id(), status)
        EventTeamManipulator.createOrUpdate(event_teams)

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            self.response.out.write("Finished calculating event team statuses for: {}".format(event_key))
    def get(self, event_key):
        df = DatafeedFMSAPI('v2.0')
        event = Event.get_by_id(event_key)

        models = df.getEventTeams(event_key)
        teams = []
        district_teams = []
        robots = []
        for group in models:
            # models is a list of tuples (team, districtTeam, robot)
            if isinstance(group[0], Team):
                teams.append(group[0])
            if isinstance(group[1], DistrictTeam):
                district_teams.append(group[1])
            if isinstance(group[2], Robot):
                robots.append(group[2])

        # Write new models
        teams = TeamManipulator.createOrUpdate(teams)
        district_teams = DistrictTeamManipulator.createOrUpdate(district_teams)
        robots = RobotManipulator.createOrUpdate(robots)

        if not teams:
            # No teams found registered for this event
            teams = []

        # Build EventTeams
        event_teams = [EventTeam(
            id=event.key_name + "_" + team.key_name,
            event=event.key,
            team=team.key,
            year=event.year)
            for team in teams]

        # Delete eventteams of teams that are no longer registered
        if event.future:
            existing_event_team_keys = set(EventTeam.query(EventTeam.event == event.key).fetch(1000, keys_only=True))
            event_team_keys = set([et.key for et in event_teams])
            et_keys_to_delete = existing_event_team_keys.difference(event_team_keys)
            EventTeamManipulator.delete_keys(et_keys_to_delete)

        event_teams = EventTeamManipulator.createOrUpdate(event_teams)
        if type(event_teams) is not list:
            event_teams = [event_teams]

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_details_get.html')
        self.response.out.write(template.render(path, template_values))
Beispiel #8
0
    def post(self, event_key_id):
        self._require_admin()
        event = Event.get_by_id(event_key_id)

        teams_csv = self.request.get('teams_csv')
        team_numbers = CSVTeamsParser.parse(teams_csv)

        event_teams = []
        for team_number in team_numbers:
            event_teams.append(ndb.Key(EventTeam, '{}_frc{}'.format(event.key.id(), team_number)))

        EventTeamManipulator.delete_keys(event_teams)

        self.redirect("/admin/event/" + event.key_name)
    def get(self, key_name):
        team_key = ndb.Key(Team, key_name)

        df = DatafeedUsfirst()
        first_eids = df.getPre2003TeamEvents(Team.get_by_id(key_name))

        new_eids = []
        for eid in first_eids:
            event_keys = Event.query(Event.first_eid == eid).fetch(
                10, keys_only=True)
            if len(event_keys
                   ) == 0:  # only create events if event not already in db
                try:
                    event = df.getEventDetails(eid)
                except:
                    logging.warning(
                        "getEventDetails for eid {} failed.".format(eid))
                    continue

                if event.event_type_enum in {
                        EventType.CMP_DIVISION, EventType.CMP_FINALS
                }:
                    if event.year >= 2001:
                        # Divisions started in 2001; need to manually create championship events
                        continue
                    else:
                        # No divisions; force event type to be finals
                        event.event_type_enum = EventType.CMP_FINALS

                event = EventManipulator.createOrUpdate(event)
                new_eids.append(eid)
            else:
                event = event_keys[0].get()

            event_team_key_name = event.key.id() + "_" + team_key.id()
            existing_event_team = ndb.Key(EventTeam, event_team_key_name).get()
            if existing_event_team is None:
                event_team = EventTeam(id=event_team_key_name,
                                       event=event.key,
                                       team=team_key,
                                       year=event.year)
                EventTeamManipulator.createOrUpdate(event_team)

        template_values = {'first_eids': first_eids, 'new_eids': new_eids}

        path = os.path.join(
            os.path.dirname(__file__),
            '../templates/datafeeds/usfirst_team_events_get.html')
        self.response.out.write(template.render(path, template_values))
    def get(self, event_key):
        teams, event_teams, et_keys_to_del = EventTeamUpdater.update(event_key)

        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        if et_keys_to_del:
            EventTeamManipulator.delete_keys(et_keys_to_del)

        template_values = {"event_teams": event_teams, "deleted_event_teams_keys": et_keys_to_del}

        path = os.path.join(os.path.dirname(__file__), "../templates/math/eventteam_update_do.html")
        self.response.out.write(template.render(path, template_values))
    def get(self, event_key):
        datafeed = DatafeedUsfirst()

        event = Event.get_by_id(event_key)
        new_awards = AwardManipulator.createOrUpdate(datafeed.getEventAwards(event))
        if new_awards is None:
            new_awards = []
        elif type(new_awards) != list:
            new_awards = [new_awards]

        # create EventTeams
        team_ids = set()
        for award in new_awards:
            for team in award.team_list:
                team_ids.add(team.id())
        teams = TeamManipulator.createOrUpdate([Team(
            id=team_id,
            team_number=int(team_id[3:]))
            for team_id in team_ids])
        if teams:
            if type(teams) is not list:
                teams = [teams]
            event_teams = EventTeamManipulator.createOrUpdate([EventTeam(
                id=event_key + "_" + team.key.id(),
                event=event.key,
                team=team.key,
                year=event.year)
                for team in teams])

        template_values = {
            'awards': new_awards,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_awards_get.html')
        self.response.out.write(template.render(path, template_values))
    def get(self, event_key):
        event = Event.get_by_id(event_key)
        team_ids = set()
        
        # Add teams from Matches
        for match in Match.query(Match.event == event.key).fetch(1000):
            for team in match.team_key_names:
                team_ids.add(team)
        
        teams = TeamManipulator.createOrUpdate([Team(
            id = team_id,
            team_number = int(team_id[3:]))
            for team_id in team_ids])

        if teams:
            event_teams = EventTeamManipulator.createOrUpdate([EventTeam(
                id = event_key + "_" + team.key.id(),
                event = event.key,
                team = team.key,
                year = event.year)
                for team in teams])
        else:
            event_teams = None
        
        template_values = {
            'event_teams': event_teams,
        }
        
        path = os.path.join(os.path.dirname(__file__), '../templates/math/eventteam_update_do.html')
        self.response.out.write(template.render(path, template_values))
    def get(self, year, first_eid):
        datafeed = DatafeedUsfirst()

        event = datafeed.getEventDetails(int(year), first_eid)
        event = EventManipulator.createOrUpdate(event)
        
        teams = datafeed.getEventTeams(int(year), first_eid)
        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            event_teams = [EventTeam(
                id = event.key.id() + "_" + team.key.id(),
                event = event.key,
                team = team.key,
                year = event.year)
                for team in teams]
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)
        else:
            event_teams = []

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }
        
        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_details_get.html')
        self.response.out.write(template.render(path, template_values))
def store_eventteam(team, event):
    eventteam = EventTeam(id="{}_{}".format(event.key_name, team.key_name))
    eventteam.event = event.key
    eventteam.team = team.key
    eventteam.year = event.year

    return EventTeamManipulator.createOrUpdate(eventteam)
Beispiel #15
0
def store_eventteam(team, event):
    eventteam = EventTeam(id="{}_{}".format(event.key_name, team.key_name))
    eventteam.event = event.key
    eventteam.team = team.key
    eventteam.year = event.year

    return EventTeamManipulator.createOrUpdate(eventteam)
    def get(self, event_key):
        datafeed = DatafeedUsfirst()

        event = Event.get_by_id(event_key)
        new_awards = AwardManipulator.createOrUpdate(datafeed.getEventAwards(event))
        if type(new_awards) != list:
            new_awards = [new_awards]

        # create EventTeams
        team_ids = set()
        for award in new_awards:
            for team in award.team_list:
                team_ids.add(team.id())
        teams = TeamManipulator.createOrUpdate([Team(
            id=team_id,
            team_number=int(team_id[3:]))
            for team_id in team_ids])
        if teams:
            event_teams = EventTeamManipulator.createOrUpdate([EventTeam(
                id=event_key + "_" + team.key.id(),
                event=event.key,
                team=team.key,
                year=event.year)
                for team in teams])

        template_values = {
            'awards': new_awards,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_awards_get.html')
        self.response.out.write(template.render(path, template_values))
    def _process_request(self, request, event_key):
        team_keys = JSONTeamListParser.parse(request.body)
        event = Event.get_by_id(event_key)

        event_teams = []
        for team_key in team_keys:
            event_teams.append(EventTeam(id=event.key.id() + '_{}'.format(team_key),
                                         event=event.key,
                                         team=ndb.Key(Team, team_key),
                                         year=event.year))

        # delete old eventteams
        old_eventteam_keys = EventTeam.query(EventTeam.event == event.key).fetch(None, keys_only=True)
        to_delete = set(old_eventteam_keys).difference(set([et.key for et in event_teams]))
        EventTeamManipulator.delete_keys(to_delete)

        EventTeamManipulator.createOrUpdate(event_teams)
    def post(self, event_key_id):
        logging.warning("Deleting %s at the request of %s / %s" % (
            event_key_id,
            users.get_current_user().user_id(),
            users.get_current_user().email()))

        event = Event.get_by_id(event_key_id)
        
        matches = Match.query(Match.event == event.key).fetch(5000)
        MatchManipulator.delete(matches)

        event_teams = EventTeam.query(EventTeam.event == event.key).fetch(5000)
        EventTeamManipulator.delete(event_teams)

        EventManipulator.delete(event)

        self.redirect("/admin/events?deleted=%s" % event_key_id)
Beispiel #19
0
    def get(self, event_key):
        _, event_teams, et_keys_to_del = EventTeamUpdater.update(event_key)

        if event_teams:
            event_teams = filter(lambda et: et.team.get() is not None, event_teams)
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        if et_keys_to_del:
            EventTeamManipulator.delete_keys(et_keys_to_del)

        template_values = {
            'event_teams': event_teams,
            'deleted_event_teams_keys': et_keys_to_del
        }

        path = os.path.join(os.path.dirname(__file__),
                            '../templates/math/eventteam_update_do.html')
        self.response.out.write(template.render(path, template_values))
Beispiel #20
0
    def post(self, event_key_id):
        self._require_admin()

        logging.warning("Deleting %s at the request of %s / %s" %
                        (event_key_id, self.user_bundle.user.user_id(),
                         self.user_bundle.user.email()))

        event = Event.get_by_id(event_key_id)

        matches = Match.query(Match.event == event.key).fetch(5000)
        MatchManipulator.delete(matches)

        event_teams = EventTeam.query(EventTeam.event == event.key).fetch(5000)
        EventTeamManipulator.delete(event_teams)

        EventManipulator.delete(event)

        self.redirect("/admin/events?deleted=%s" % event_key_id)
    def get(self, event_key):
        _, event_teams, et_keys_to_del = EventTeamUpdater.update(event_key)

        if event_teams:
            event_teams = filter(lambda et: et.team.get() is not None, event_teams)
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        if et_keys_to_del:
            EventTeamManipulator.delete_keys(et_keys_to_del)

        template_values = {
            'event_teams': event_teams,
            'deleted_event_teams_keys': et_keys_to_del
        }

        path = os.path.join(os.path.dirname(__file__),
                            '../templates/math/eventteam_update_do.html')
        self.response.out.write(template.render(path, template_values))
    def get(self, key_name):
        team_key = ndb.Key(Team, key_name)

        df = DatafeedUsfirst()
        first_eids = df.getPre2003TeamEvents(Team.get_by_id(key_name))

        new_eids = []
        for eid in first_eids:
            event_keys = Event.query(Event.first_eid == eid).fetch(10, keys_only=True)
            if len(event_keys) == 0:  # only create events if event not already in db
                try:
                    event = df.getEventDetails(eid)
                except:
                    logging.warning("getEventDetails for eid {} failed.".format(eid))
                    continue

                if event.event_type_enum in {EventType.CMP_DIVISION, EventType.CMP_FINALS}:
                    if event.year >= 2001:
                        # Divisions started in 2001; need to manually create championship events
                        continue
                    else:
                        # No divisions; force event type to be finals
                        event.event_type_enum = EventType.CMP_FINALS

                event = EventManipulator.createOrUpdate(event)
                new_eids.append(eid)
            else:
                event = event_keys[0].get()

            event_team_key_name = event.key.id() + "_" + team_key.id()
            existing_event_team = ndb.Key(EventTeam, event_team_key_name).get()
            if existing_event_team is None:
                event_team = EventTeam(
                    id=event_team_key_name,
                    event=event.key,
                    team=team_key,
                    year=event.year)
                EventTeamManipulator.createOrUpdate(event_team)

        template_values = {'first_eids': first_eids,
                           'new_eids': new_eids}

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_events_get.html')
        self.response.out.write(template.render(path, template_values))
    def createEventTeams(self, event):
        teams = Team.query().order(Team.team_number).fetch(60)

        event_teams = [EventTeam(
            id = event.key.id() + "_" + team.key.id(),
            event = event.key,
            team = team.key,
            year = event.year)
            for team in teams]
        return EventTeamManipulator.createOrUpdate(event_teams)
    def createEventTeams(self, event):
        teams = Team.query().order(Team.team_number).fetch(60)

        event_teams = [
            EventTeam(id=event.key.id() + "_" + team.key.id(),
                      event=event.key,
                      team=team.key,
                      year=event.year) for team in teams
        ]
        return EventTeamManipulator.createOrUpdate(event_teams)
    def _process_request(self, request, event_key):
        team_keys = JSONTeamListParser.parse(request.body)

        event_teams = []
        for team_key in team_keys:
            if Team.get_by_id(team_key):  # Don't create EventTeams for teams that don't exist
                event_teams.append(EventTeam(id=self.event.key.id() + '_{}'.format(team_key),
                                             event=self.event.key,
                                             team=ndb.Key(Team, team_key),
                                             year=self.event.year))

        # delete old eventteams
        old_eventteam_keys = EventTeam.query(EventTeam.event == self.event.key).fetch(None, keys_only=True)
        to_delete = set(old_eventteam_keys).difference(set([et.key for et in event_teams]))
        EventTeamManipulator.delete_keys(to_delete)

        EventTeamManipulator.createOrUpdate(event_teams)

        self.response.out.write(json.dumps({'Success': "Event teams successfully updated"}))
    def _process_request(self, request, event_key):
        team_keys = JSONTeamListParser.parse(request.body)
        event = Event.get_by_id(event_key)

        event_teams = []
        for team_key in team_keys:
            event_teams.append(
                EventTeam(id=event.key.id() + '_{}'.format(team_key),
                          event=event.key,
                          team=ndb.Key(Team, team_key),
                          year=event.year))

        # delete old eventteams
        old_eventteam_keys = EventTeam.query(
            EventTeam.event == event.key).fetch(None, keys_only=True)
        to_delete = set(old_eventteam_keys).difference(
            set([et.key for et in event_teams]))
        EventTeamManipulator.delete_keys(to_delete)

        EventTeamManipulator.createOrUpdate(event_teams)
Beispiel #27
0
    def post(self, event_key_id):
        self._require_admin()
        event = Event.get_by_id(event_key_id)

        teams_csv = self.request.get('teams_csv')
        team_numbers = CSVTeamsParser.parse(teams_csv)

        event_teams = []
        teams = []
        for team_number in team_numbers:
            event_teams.append(EventTeam(id=event.key.id() + '_frc{}'.format(team_number),
                                         event=event.key,
                                         team=ndb.Key(Team, 'frc{}'.format(team_number)),
                                         year=event.year))
            teams.append(Team(id='frc{}'.format(team_number),
                              team_number=int(team_number)))

        EventTeamManipulator.createOrUpdate(event_teams)
        TeamManipulator.createOrUpdate(teams)

        self.redirect("/admin/event/" + event.key_name)
Beispiel #28
0
    def test_repair(self):
        event_team = EventTeam.get_by_id("2011ct_frc177")
        self.assertEqual(event_team.year, None)

        broken_event_teams = EventTeam.query(EventTeam.year == None).fetch()
        self.assertGreater(len(broken_event_teams), 0)

        fixed_event_teams = EventTeamRepairer.repair(broken_event_teams)
        fixed_event_teams = EventTeamManipulator.createOrUpdate(fixed_event_teams)

        event_team = EventTeam.get_by_id("2011ct_frc177")
        self.assertEqual(event_team.year, 2011)
    def get(self):
        event_teams_keys = EventTeam.query(EventTeam.year == None).fetch(keys_only=True)
        event_teams = ndb.get_multi(event_teams_keys)

        event_teams = EventTeamRepairer.repair(event_teams)
        event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        # sigh. -gregmarra
        if type(event_teams) == EventTeam:
            event_teams = [event_teams]

        template_values = {"event_teams": event_teams}

        path = os.path.join(os.path.dirname(__file__), "../templates/math/eventteam_repair_do.html")
        self.response.out.write(template.render(path, template_values))
    def get(self):
        event_teams = EventTeam.query(EventTeam.year == None).fetch()

        event_teams = EventTeamRepairer.repair(event_teams)
        event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        # sigh. -gregmarra
        if type(event_teams) == EventTeam:
            event_teams = [event_teams]
        
        template_values = {
            'event_teams': event_teams,
        }
        
        path = os.path.join(os.path.dirname(__file__), '../templates/math/eventteam_repair_do.html')
        self.response.out.write(template.render(path, template_values))
Beispiel #31
0
    def get(self):
        event_teams_keys = EventTeam.query(EventTeam.year == None).fetch(keys_only=True)
        event_teams = ndb.get_multi(event_teams_keys)

        event_teams = EventTeamRepairer.repair(event_teams)
        event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        # sigh. -gregmarra
        if type(event_teams) == EventTeam:
            event_teams = [event_teams]

        template_values = {
            'event_teams': event_teams,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/math/eventteam_repair_do.html')
        self.response.out.write(template.render(path, template_values))
Beispiel #32
0
    def get(self, event_key):
        datafeed = DatafeedFMSAPI('v2.0', save_response=True)

        event = Event.get_by_id(event_key)
        awards = datafeed.getAwards(event)

        if event and event.remap_teams:
            EventHelper.remapteams_awards(awards, event.remap_teams)

        new_awards = AwardManipulator.createOrUpdate(awards)

        if new_awards is None:
            new_awards = []
        elif type(new_awards) != list:
            new_awards = [new_awards]

        # create EventTeams
        team_ids = set()
        for award in new_awards:
            for team in award.team_list:
                team_ids.add(team.id())
        teams = TeamManipulator.createOrUpdate([
            Team(id=team_id, team_number=int(team_id[3:]))
            for team_id in team_ids
        ])
        if teams:
            if type(teams) is not list:
                teams = [teams]
            event_teams = EventTeamManipulator.createOrUpdate([
                EventTeam(id=event_key + "_" + team.key.id(),
                          event=event.key,
                          team=team.key,
                          year=event.year) for team in teams
            ])

        template_values = {
            'awards': new_awards,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(
                os.path.dirname(__file__),
                '../templates/datafeeds/usfirst_awards_get.html')
            self.response.out.write(template.render(path, template_values))
    def get(self, year, first_eid):
        df = DatafeedUsfirst()
        df_legacy = DatafeedUsfirstLegacy()

        event = df.getEventDetails(first_eid)
        if not event:
            logging.warning("getEventDetails with DatafeedUsfirst for event id {} failed. Retrying with DatafeedUsfirstLegacy.".format(first_eid))
            event = df_legacy.getEventDetails(int(year), first_eid)
        event = EventManipulator.createOrUpdate(event)

        teams = df.getEventTeams(int(year), first_eid)
        if not teams:
            logging.warning("getEventTeams with DatafeedUsfirst for event id {} failed. Retrying with DatafeedUsfirstLegacy.".format(first_eid))
            teams = df_legacy.getEventTeams(int(year), first_eid)
            if not teams:
                logging.warning("getEventTeams with DatafeedUsfirstLegacy for event id {} failed.".format(first_eid))
                teams = []

        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            if type(teams) is not list:
                teams = [teams]

            event_teams = [EventTeam(
                id=event.key.id() + "_" + team.key.id(),
                event=event.key,
                team=team.key,
                year=event.year)
                for team in teams]
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)
            if type(event_teams) is not list:
                event_teams = [event_teams]
        else:
            event_teams = []

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_details_get.html')
        self.response.out.write(template.render(path, template_values))
    def get(self, event_key):
        teams, event_teams, et_keys_to_del = EventTeamUpdater.update(event_key)

        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        if et_keys_to_del:
            ndb.delete_multi(et_keys_to_del)

        template_values = {
            'event_teams': event_teams,
            'deleted_event_teams_keys': et_keys_to_del
        }

        path = os.path.join(os.path.dirname(__file__),
                            '../templates/math/eventteam_update_do.html')
        self.response.out.write(template.render(path, template_values))
    def get(self, event_key):
        datafeed = DatafeedFMSAPI('v2.0', save_response=True)

        event = Event.get_by_id(event_key)
        awards = datafeed.getAwards(event)

        if event and event.remap_teams:
            EventHelper.remapteams_awards(awards, event.remap_teams)

        new_awards = AwardManipulator.createOrUpdate(awards)

        if new_awards is None:
            new_awards = []
        elif type(new_awards) != list:
            new_awards = [new_awards]

        # create EventTeams
        team_ids = set()
        for award in new_awards:
            for team in award.team_list:
                team_ids.add(team.id())
        teams = TeamManipulator.createOrUpdate([Team(
            id=team_id,
            team_number=int(team_id[3:]))
            for team_id in team_ids])
        if teams:
            if type(teams) is not list:
                teams = [teams]
            event_teams = EventTeamManipulator.createOrUpdate([EventTeam(
                id=event_key + "_" + team.key.id(),
                event=event.key,
                team=team.key,
                year=event.year)
                for team in teams])

        template_values = {
            'awards': new_awards,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_awards_get.html')
            self.response.out.write(template.render(path, template_values))
Beispiel #36
0
    def get(self, event_key):
        df = DatafeedFMSAPI('v2.0')
        df2 = DatafeedFIRSTElasticSearch()

        event = Event.get_by_id(event_key)

        # Update event
        fmsapi_events, fmsapi_districts = df.getEventDetails(event_key)
        elasticsearch_events = df2.getEventDetails(event)
        updated_event = EventManipulator.mergeModels(fmsapi_events,
                                                     elasticsearch_events)
        if updated_event:
            event = EventManipulator.createOrUpdate(updated_event)
        DistrictManipulator.createOrUpdate(fmsapi_districts)

        models = df.getEventTeams(event_key)
        teams = []
        district_teams = []
        robots = []
        for group in models:
            # models is a list of tuples (team, districtTeam, robot)
            if isinstance(group[0], Team):
                teams.append(group[0])
            if isinstance(group[1], DistrictTeam):
                district_teams.append(group[1])
            if isinstance(group[2], Robot):
                robots.append(group[2])

        # Merge teams
        teams = TeamManipulator.mergeModels(teams, df2.getEventTeams(event))

        # Write new models
        if teams and event.year == tba_config.MAX_YEAR:  # Only update from latest year
            teams = TeamManipulator.createOrUpdate(teams)
        district_teams = DistrictTeamManipulator.createOrUpdate(district_teams)
        robots = RobotManipulator.createOrUpdate(robots)

        if not teams:
            # No teams found registered for this event
            teams = []
        if type(teams) is not list:
            teams = [teams]

        # Build EventTeams
        cmp_hack_sitevar = Sitevar.get_or_insert('cmp_registration_hacks')
        events_without_eventteams = cmp_hack_sitevar.contents.get('skip_eventteams', []) \
            if cmp_hack_sitevar else []
        skip_eventteams = event_key in events_without_eventteams
        event_teams = [
            EventTeam(id=event.key_name + "_" + team.key_name,
                      event=event.key,
                      team=team.key,
                      year=event.year) for team in teams
        ] if not skip_eventteams else []

        # Delete eventteams of teams that are no longer registered
        if event_teams and not skip_eventteams:
            existing_event_team_keys = set(
                EventTeam.query(EventTeam.event == event.key).fetch(
                    1000, keys_only=True))
            event_team_keys = set([et.key for et in event_teams])
            et_keys_to_delete = existing_event_team_keys.difference(
                event_team_keys)
            EventTeamManipulator.delete_keys(et_keys_to_delete)

            event_teams = EventTeamManipulator.createOrUpdate(event_teams)
        if type(event_teams) is not list:
            event_teams = [event_teams]

        if event.year in {2018, 2019, 2020}:
            avatars, keys_to_delete = df.getEventTeamAvatars(event.key_name)
            if avatars:
                MediaManipulator.createOrUpdate(avatars)
            MediaManipulator.delete_keys(keys_to_delete)

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(
                os.path.dirname(__file__),
                '../templates/datafeeds/usfirst_event_details_get.html')
            self.response.out.write(template.render(path, template_values))
    def get(self, event_key):
        df = DatafeedFMSAPI('v2.0')
        df2 = DatafeedFIRSTElasticSearch()

        event = Event.get_by_id(event_key)

        # Update event
        fmsapi_events, fmsapi_districts = df.getEventDetails(event_key)
        elasticsearch_events = df2.getEventDetails(event)
        updated_event = EventManipulator.mergeModels(
            fmsapi_events,
            elasticsearch_events)
        if updated_event:
            event = EventManipulator.createOrUpdate(updated_event)
        DistrictManipulator.createOrUpdate(fmsapi_districts)

        models = df.getEventTeams(event_key)
        teams = []
        district_teams = []
        robots = []
        for group in models:
            # models is a list of tuples (team, districtTeam, robot)
            if isinstance(group[0], Team):
                teams.append(group[0])
            if isinstance(group[1], DistrictTeam):
                district_teams.append(group[1])
            if isinstance(group[2], Robot):
                robots.append(group[2])

        # Merge teams
        teams = TeamManipulator.mergeModels(teams, df2.getEventTeams(event))

        # Write new models
        if teams:
            teams = TeamManipulator.createOrUpdate(teams)
        district_teams = DistrictTeamManipulator.createOrUpdate(district_teams)
        robots = RobotManipulator.createOrUpdate(robots)

        if not teams:
            # No teams found registered for this event
            teams = []
        if type(teams) is not list:
            teams = [teams]

        # Build EventTeams
        cmp_hack_sitevar = Sitevar.get_or_insert('cmp_registration_hacks')
        events_without_eventteams = cmp_hack_sitevar.contents.get('skip_eventteams', []) \
            if cmp_hack_sitevar else []
        skip_eventteams = event_key in events_without_eventteams
        event_teams = [EventTeam(
            id=event.key_name + "_" + team.key_name,
            event=event.key,
            team=team.key,
            year=event.year)
            for team in teams] if not skip_eventteams else []

        # Delete eventteams of teams that are no longer registered
        if event_teams != [] or skip_eventteams:
            existing_event_team_keys = set(EventTeam.query(EventTeam.event == event.key).fetch(1000, keys_only=True))
            event_team_keys = set([et.key for et in event_teams])
            et_keys_to_delete = existing_event_team_keys.difference(event_team_keys)
            EventTeamManipulator.delete_keys(et_keys_to_delete)

            event_teams = EventTeamManipulator.createOrUpdate(event_teams)
        if type(event_teams) is not list:
            event_teams = [event_teams]

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_details_get.html')
            self.response.out.write(template.render(path, template_values))
Beispiel #38
0
    def resetAll(self, flushed=False):
        response = self.testapp.get('/api/v2/events/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)

        EventManipulator.createOrUpdate(self.event_2010sc_1)
        if flushed:
            self.assertEqual(memcache.get(self.eventlist_2010_cache_key), None)
        TeamManipulator.createOrUpdate(self.team_frc1_1)
        TeamManipulator.createOrUpdate(self.team_frc2_1)
        EventTeamManipulator.createOrUpdate(self.eventteam_2010sc_frc1)
        EventTeamManipulator.createOrUpdate(self.eventteam_2010sc_frc2)
        MatchManipulator.createOrUpdate(self.match1_1)
        AwardManipulator.createOrUpdate(self.award1_1)

        response = self.testapp.get('/api/v2/events/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.event_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/teams', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/matches', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/stats', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/rankings', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/awards', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/team/frc1/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc1_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/team/frc2/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc2_cache_key), None)
Beispiel #39
0
    def testApiCacheClear(self):
        self.assertEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll(flushed=True)

        # this shouldn't evict any caches
        EventManipulator.createOrUpdate(self.event_2010sc_1)
        EventTeamManipulator.createOrUpdate(self.eventteam_2010sc_frc1)
        EventTeamManipulator.createOrUpdate(self.eventteam_2010sc_frc2)
        AwardManipulator.createOrUpdate(self.award1_1)
        MatchManipulator.createOrUpdate(self.match1_1)
        TeamManipulator.createOrUpdate(self.team_frc1_1)
        TeamManipulator.createOrUpdate(self.team_frc2_1)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc2_cache_key), None)

        # updating an event
        EventManipulator.createOrUpdate(self.event_2010sc_2)
        self.assertEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # updating a team
        TeamManipulator.createOrUpdate(self.team_frc1_2)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # updating a match
        MatchManipulator.createOrUpdate(self.match1_2)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # updating an award
        AwardManipulator.createOrUpdate(self.award1_2)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # deleting an award
        AwardManipulator.delete(self.award1_2)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # deleting a match
        MatchManipulator.delete(self.match1_2)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # deleting a team
        TeamManipulator.delete(self.team_frc2_2)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # deleting an event
        EventManipulator.delete(self.event_2010sc_2)
        self.assertEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        self.resetAll()

        # deleting an eventteam
        EventTeamManipulator.delete(self.eventteam_2010sc_frc1)
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
        self.assertNotEqual(memcache.get(self.team_frc2_cache_key), None)