sg


On Sun, Aug 4, 2013 at 12:53 PM, Eugene Fang <notifications@github.com>wrote:

> In controllers/cron_controller.py:
>
> >          # Add teams from Matches
> >          match_keys = Match.query(Match.event == event.key).fetch(1000, keys_only=True)
> >          matches = ndb.get_multi(match_keys)
> >          for match in matches:
> >              for team in match.team_key_names:
> >                  team_ids.add(team)
> > +                participating_team_ids.add(str(team))
> > +
> > +        # Delete EventTeams for teams who did not participate in the event
> > +        et_keys_to_delete = set()
> > +        for team_id in existing_team_ids.difference(participating_team_ids):
> > +            et_key_name = "{}_{}".format(event.key_name, team_id)
> > +            et_keys_to_delete.add(ndb.Key(EventTeam, et_key_name))
> > +        ndb.delete_multi(et_keys_to_delete)
>
> We don't have anything in the manipulators that support deleting keys. The
> closest one is
>
> @classmethod
> def delete(self, models):
> keys = [model.key for model in self.listify(models)]
> ndb.delete_multi(keys)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/gregmarra/the-blue-alliance/pull/675/files#r5570411>
> .
>