adjusted game diplay for half-inning changeover, changed title of web page

This commit is contained in:
Sakimori 2020-12-30 02:48:39 -05:00
parent d5994b783b
commit 46528deb5e
9 changed files with 49 additions and 21 deletions

View File

@ -44,6 +44,8 @@ def update_loop():
state["update_text"] = "Play blall!" #they also need a timestamp state["update_text"] = "Play blall!" #they also need a timestamp
state["delay"] -= 1 state["delay"] -= 1
state["display_top_of_inning"] = state["top_of_inning"]
if state["delay"] <= 0: if state["delay"] <= 0:
if this_game.top_of_inning != state["top_of_inning"]: if this_game.top_of_inning != state["top_of_inning"]:
state["update_pause"] = 2 state["update_pause"] = 2
@ -51,6 +53,7 @@ def update_loop():
state["batter"] = "-" state["batter"] = "-"
if not state["top_of_inning"]: if not state["top_of_inning"]:
state["display_inning"] -= 1 state["display_inning"] -= 1
state["display_top_of_inning"] = False
if state["update_pause"] == 1: if state["update_pause"] == 1:
state["update_emoji"] = "🍿" state["update_emoji"] = "🍿"
@ -100,4 +103,4 @@ def update_loop():
state["update_pause"] -= 1 state["update_pause"] -= 1
socketio.emit("states_update", states_to_send) socketio.emit("states_update", states_to_send)
time.sleep(1) time.sleep(3)

View File

@ -0,0 +1,8 @@
SELECT name,
plate_appearances - (walks_taken + sacrifices) as atbats,
ROUND(hits*1.0 / (plate_appearances - (walks_taken + sacrifices)*1.0),3) as average,
ROUND(total_bases*1.0 / (plate_appearances - (walks_taken + sacrifices)*1.0),3) as slg,
ROUND((walks_taken + hits)*1.0/plate_appearances*1.0,3) as obp,
ROUND((walks_taken + hits)*1.0/plate_appearances*1.0,3) + ROUND(total_bases*1.0 / (plate_appearances - (walks_taken + sacrifices)*1.0),3) as ops
FROM stats WHERE plate_appearances > 50
ORDER BY ops DESC;

View File

@ -0,0 +1,9 @@
SELECT name,
outs_pitched,
ROUND(runs_allowed*27.0/(outs_pitched*1.0),3) as era,
ROUND((walks_allowed+hits_allowed)*3.0/(outs_pitched*1.0),3) as whip,
ROUND(walks_allowed*27.0/(outs_pitched*1.0),3) as bbper9,
ROUND(strikeouts_given*27.0/(outs_pitched*1.0),3) as kper9,
ROUND(strikeouts_given*1.0/walks_allowed*1.0,3) as kperbb
FROM stats WHERE outs_pitched > 150
ORDER BY bbper9 ASC;

BIN
static/discord.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -1,4 +1,5 @@
@import url('https://fonts.googleapis.com/css2?family=Alegreya&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Alegreya&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Goldman:wght@700&display=swap');
body { body {
background-image: url("prism.png"); background-image: url("prism.png");
} }
@ -21,12 +22,17 @@ body {
grid-row: 1; grid-row: 1;
} }
.h1 { .link{
margin: auto; position: relative;
width: 45%; top: 10px;
font-family: 'Alegreya', serif;
} }
.page_header {
color: white;
font-family: 'Goldman', cursive;
}
.emptyslot { .emptyslot {
border: 2px dashed white; border: 2px dashed white;
border-radius: 15px; border-radius: 15px;

View File

@ -50,7 +50,7 @@ $(document).ready(function (){
const updateGame = (gamediv, gamestate) => { const updateGame = (gamediv, gamestate) => {
gamediv.id = "updateTarget"; gamediv.id = "updateTarget";
$('#updateTarget .inning').html("Inning: " + (gamestate.top_of_inning ? "🔼" : "🔽") + " " + gamestate.display_inning + "/" + gamestate.max_innings); $('#updateTarget .inning').html("Inning: " + (gamestate.display_top_of_inning ? "🔼" : "🔽") + " " + gamestate.display_inning + "/" + gamestate.max_innings);
$('#updateTarget .weather').html(gamestate.weather_emoji + " " + gamestate.weather_text); $('#updateTarget .weather').html(gamestate.weather_emoji + " " + gamestate.weather_text);
$('#updateTarget .away_name').html(gamestate.away_name); $('#updateTarget .away_name').html(gamestate.away_name);

View File

@ -11,22 +11,11 @@
<body> <body>
<section class="container" id="container"> <section class="container" id="container">
<div></div> <div></div>
<div class="emptyslot" id="title"> <div id="title">
<h1>game page ahoy</h1> <h2 class="page_header">THE SIMMADOME</h2>
<h2 class="page_header">Join SIBR on <a href="https://discord.gg/UhAajY2NCW" class="link"><img src="static/discord.png" height="30"></a> to start your own games!</h2>
</div> </div>
<div></div> <div></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
<div class="emptyslot"></div>
</section> </section>
</body> </body>
</html> </html>

View File

@ -57,6 +57,7 @@
<Content Include="games_config.json" /> <Content Include="games_config.json" />
<Content Include="ids" /> <Content Include="ids" />
<Content Include="matteo.db" /> <Content Include="matteo.db" />
<Content Include="static\discord.png" />
<Content Include="static\games_page.css" /> <Content Include="static\games_page.css" />
<Content Include="static\loader.js" /> <Content Include="static\loader.js" />
<Content Include="static\prism.png" /> <Content Include="static\prism.png" />

12
weather_notes.txt Normal file
View File

@ -0,0 +1,12 @@
fog
hit by pitch, pickoffs
hbp can either hit leg (reduces baserunning) or arm (reduces defense)
heat wave
forces relief pitchers
blizzard
makes pitchers bat
light drizzle
runners start on second base at the start of each inning