예제 #1
0
def home():
    season, num_week = get_season_week()
    games = Game.query.filter_by(week=num_week)
    if games is None:
        week = Week(num_week)
        week.add_games(num_week)
        games = Game.query.filter_by(week=num_week)
    update_scores()
예제 #2
0
 def __init__(self, game_id, home_team, away_team, away_rank, home_rank):
     self.id = game_id
     self.week = get_season_week()[1]
     self.home_team = home_team
     self.away_team = away_team
     self.away_rank = away_rank
     self.home_rank = home_rank
     self.home_score = 0
     self.away_score = 0
예제 #3
0
 def add_games(self, week):
     games_of_the_week = data.main(get_season_week()[1])
     for row, index in games_of_the_week.iteritems():
         game = Game(game_id=row['id'],
                     home_team=row['homeTeam'],
                     away_team=row['awayTeam'],
                     away_rank=row['awayRank'],
                     home_rank=row['homeRank'])
         db.session.add(game)
         db.session.commit()
예제 #4
0
def index():
    user = current_user
    week = get_season_week()[1]
    games = Game.query.filter_by(week=week)
    if games is None:
        week = Week(week)
        week.add_games(num_week)
        games = Game.query.filter_by(week=num_week)
    update_scores()
    if current_user.is_authenticated:
        if current_user.confirmed:
            return render_template('index.html', user=user, title='Home')
        else:
            return redirect(url_for('auth.unconfirmed'))
    return render_template('index.html', user=user, title='Home')
예제 #5
0
 def __init__(self, week, start, end):
     self.number = get_season_week()[1]
     self.start = start
     self.end = end