BraydenMoore commited on
Commit
fea52d0
1 Parent(s): 0341fde

Add Week 5 lines

Browse files
Files changed (1) hide show
  1. main.py +5 -1
main.py CHANGED
@@ -31,6 +31,10 @@ available_weeks.reverse()
31
  def index():
32
  print('Current Week', current_week)
33
  session['selected_week'] = current_week
 
 
 
 
34
  session[f'games_week_{current_week}'] = current_games.to_json()
35
  return render_template('index.html', **record)
36
 
@@ -57,7 +61,7 @@ def get_games():
57
  if requested_week and requested_week != current_week:
58
  print("Requested Week:", requested_week)
59
  # Check if that week's games are cached
60
- if type(session.get(f'games_week_{requested_week}')) == list:
61
  print("Using cached games")
62
  print(session.get(f'games_week_{requested_week}'))
63
  games = session.get(f'games_week_{requested_week}')
 
31
  def index():
32
  print('Current Week', current_week)
33
  session['selected_week'] = current_week
34
+
35
+ for week in available_weeks:
36
+ session[f'games_week_{week}'] = None
37
+
38
  session[f'games_week_{current_week}'] = current_games.to_json()
39
  return render_template('index.html', **record)
40
 
 
61
  if requested_week and requested_week != current_week:
62
  print("Requested Week:", requested_week)
63
  # Check if that week's games are cached
64
+ if session.get(f'games_week_{requested_week}'):
65
  print("Using cached games")
66
  print(session.get(f'games_week_{requested_week}'))
67
  games = session.get(f'games_week_{requested_week}')