Beispiel #1
0
 def _delete(self):
     query = Spread.all()
     query.filter('week =', str(12))
     result = query.fetch(1000)
     
     for item in result:
         key = item.key()
         matchup = Spread.get(key)
         matchup.delete()
Beispiel #2
0
    def _query_database(self, week):
        query = {}
        result = {}
        
        query = Spread.all()
        query.filter('week =', week)
        query.order('person')

        result = query.fetch(constants.QUERY_LIMIT)
        return result
Beispiel #3
0
    def _save_spread(self, week, spread):
        query = Spread.all()
        result = None
        item = None

        query.filter('week =', week)
        result = query.fetch(constants.QUERY_LIMIT)
        
        if len(result) == 0:
            #completely new save
            for person in spread:
                for line in spread[person]:
                    item = Spread(
                        year = constants.YEAR,
                        week = week,
                        person = person,
                        team_name = line[constants.SPREAD_TEAM_NAME],
                        over_under = line[constants.SPREAD_OVER_UNDER],
                        total_score = int(line[constants.SPREAD_TOTAL_SCORE])
                        )

                    item.put()