Пример #1
0
def get_coach_stats(coach_id):
    """get coach with detailed info"""
    coach = Coach.query.options(selectinload(Coach.packs)).get(coach_id)
    season = request.args.get("season", current_season())
    if coach is None:
        abort(404)
    return etagjsonify(coach.stats(season))
Пример #2
0
 def stats(self,season=current_season()):
     app = db.get_app()
     stats = StatsHandler(season)
     stats_data = stats.get_stats()
     if self.bb2_name:
       coach_stats = stats_data['coaches'].get(self.bb2_name, {})
       return coach_stats
     return {}
Пример #3
0
def get_coaches_leaderboard():
    """return leaderboard json"""
    season = request.args.get("season", current_season())
    stats = StatsHandler(season)
    result = {}
    result['coaches'] = stats.get_stats()['coaches_extra']
    result['coach_stats'] = list(stats.get_stats()['coaches'].values())
    return etagjsonify(result)
Пример #4
0
 def __init__(self,**kwargs):
     super(Transaction, self).__init__(**kwargs)
     self.season = current_season()
Пример #5
0
 def active_cards(self):
     return Card.query.join(Card.pack).filter(Pack.coach_id == self.id).filter(Pack.season == current_season()).all()
Пример #6
0
 def earned(self):
     cash = 0
     for tr in self.account.transactions:
         if tr.price<0 and tr.season==current_season():
             cash += -1*tr.price
     return cash
Пример #7
0
 def __init__(self,**kwargs):
     super(Pack, self).__init__(**kwargs)
     self.season = current_season()
Пример #8
0
 def __init__(self, season=None):
   if not season:
     season = current_season()
   self.__season = season