Exemplo n.º 1
0
 def search(self, win_player_id):
     if self.r.exists(win_player_id) != 0:
         competitions = pickle.loads(self.r.get(win_player_id))
     else:
         query = {}
         if win_player_id != '0':
             query["winner._id"] = win_player_id # ObjectId(request.GET['client_id'])
             competitions = list(self.competitions.find(query))
         self.r.set(win_player_id,  pickle.dumps(competitions))
     new_competitions = []
     for x in competitions:
         new_competitions.append(competitionFromDict(x))
     return new_competitions
Exemplo n.º 2
0
 def getCompetition(self, id):
     return competitionFromDict(self.competitions.find_one({'_id': id}))
Exemplo n.º 3
0
 def getCompetitionsList(self):
     competitions = []
     comp = self.competitions.find()
     for x in comp:
         competitions.append(competitionFromDict(x))
     return competitions