Readded commands to save game history

This commit is contained in:
Kevin Rode 2021-01-05 20:38:02 -05:00
parent 4cf5e48910
commit 120496f66b

View File

@ -1,6 +1,7 @@
import asyncio, time, datetime, games, json, threading, jinja2, leagues import asyncio, time, datetime, games, json, threading, jinja2, leagues
from flask import Flask, url_for, Response, render_template, request, jsonify from flask import Flask, url_for, Response, render_template, request, jsonify
from flask_socketio import SocketIO, emit from flask_socketio import SocketIO, emit
import database as db
app = Flask("the-prestige") app = Flask("the-prestige")
app.config['SECRET KEY'] = 'dev' app.config['SECRET KEY'] = 'dev'
@ -63,6 +64,7 @@ def update_loop():
if state["update_pause"] == 1: if state["update_pause"] == 1:
state["update_emoji"] = "🍿" state["update_emoji"] = "🍿"
if this_game.over: if this_game.over:
db.cache_history(this_game.teams['home'].name, this_game.teams["home"].score, this_game.teams['away'].name, this_game.teams['away'].score)
state["display_inning"] -= 1 state["display_inning"] -= 1
state["display_top_of_inning"] = False state["display_top_of_inning"] = False
winning_team = this_game.teams['home'].name if this_game.teams['home'].score > this_game.teams['away'].score else this_game.teams['away'].name winning_team = this_game.teams['home'].name if this_game.teams['home'].score > this_game.teams['away'].score else this_game.teams['away'].name