17 Commits

Author SHA1 Message Date
085514ab16 fix: change date crossover to 3:00 am ETC (#39) 2024-02-22 02:01:01 -05:00
960ff6e5ac fix: change date crossover to 3:00 am ETC 2024-02-22 02:00:39 -05:00
04e29469dd fix: adjust scoreboard time (#38) 2024-02-22 01:57:10 -05:00
360188114e fix: adjust scoreboard time 2024-02-22 01:56:46 -05:00
982fdfb3c1 merge develop into main for v4.1.2 (#37) 2024-02-22 01:17:52 -05:00
94f9cced2e game priority: double differential adjustment at 5 minutes left in third 2024-02-22 01:17:13 -05:00
3edb84c333 fix: change scale to 650 instead of 600 2024-02-22 01:16:31 -05:00
6ec9a7aef1 fix: lower weight of total score 2024-02-22 00:14:39 -05:00
dfb86f6fd5 changes hype meter scale to 600 instead of 700 2024-02-22 00:14:14 -05:00
e5824cefc5 fix: sort games in intermission by time left 2024-02-22 00:11:22 -05:00
18ff48cc2c feat: add matchup adjustment scaling. Earlier the period, the heavier… (#36) 2024-02-21 23:52:44 -05:00
8c5de8602f feat: add matchup adjustment scaling. Earlier the period, the heavier we way the matchup strength 2024-02-21 23:52:06 -05:00
9f4a6c966a merge develop into main for v4.0.1 (#35) 2024-02-21 23:43:29 -05:00
4da3c2dfdd fix: live game adjustments 2024-02-21 23:42:41 -05:00
07ff5ac055 feat: Push the games that are in intermission to the bottom, but retain their sort 2024-02-21 18:40:21 -05:00
fe7449537b fix: minor header adjustments 2024-02-21 18:34:26 -05:00
dd8d1ca12b fix: adjust pre and final state 2024-02-21 01:30:00 -05:00
4 changed files with 60 additions and 45 deletions

View File

@@ -6,8 +6,8 @@ SCOREBOARD_DATA_FILE = 'app/data/scoreboard_data.json'
def get_scoreboard_data():
now = datetime.now()
start_time_evening = now.replace(hour=23, minute=00, second=0, microsecond=0) # 7:00 PM EST
end_time_evening = now.replace(hour=8, minute=00, second=0, microsecond=0) # 3:00 AM EST
start_time_evening = now.replace(hour=19, minute=00, second=0, microsecond=0) # 7:00 PM EST
end_time_evening = now.replace(hour=3, minute=00, second=0, microsecond=0) # 3:00 AM EST
if now >= start_time_evening or now < end_time_evening:
# Use now URL

View File

@@ -76,8 +76,16 @@ def get_game_outcome(game, game_state):
def calculate_game_priority(game):
# Return 0 if game is in certain states
if game["gameState"] in ["FINAL", "OFF", "PRE", "FUT"] or game["clock"]["inIntermission"]:
if game["gameState"] in ["FINAL", "OFF", "PRE", "FUT"]:
return 0
# Get period, time remaining, scores, and other relevant data
period = game.get("periodDescriptor", {}).get("number", 0)
time_remaining = game.get("clock", {}).get("secondsRemaining", 0)
home_score = game["homeTeam"]["score"]
away_score = game["awayTeam"]["score"]
score_difference = abs(home_score - away_score)
score_total = (home_score + away_score) * 20
# Get standings for home and away teams
home_team_standings = get_team_standings(game["homeTeam"]["name"]["default"])
@@ -88,26 +96,26 @@ def calculate_game_priority(game):
away_total = away_team_standings["league_sequence"] + away_team_standings["league_l10_sequence"]
# Calculate the matchup adjustment factor
matchup_adjustment = home_total + away_total
# Get period, time remaining, scores, and other relevant data
period = game.get("periodDescriptor", {}).get("number", 0)
time_remaining = game.get("clock", {}).get("secondsRemaining", 0)
home_score = game["homeTeam"]["score"]
away_score = game["awayTeam"]["score"]
score_difference = abs(home_score - away_score)
score_total = (home_score + away_score) * 25
matchup_multiplier = {5: 1, 4: 1, 3: 1.25, 2: 1.50, 1: 2}.get(period)
matchup_adjustment = (home_total + away_total) * matchup_multiplier
# Calculate the base priority based on period
base_priority = {5: 650, 4: 600, 3: 300, 2: 200}.get(period, 100)
# Adjust base priority based on score difference
score_differential_adjustment = 0
if score_difference > 3:
base_priority -= 500
score_differential_adjustment += 500
elif score_difference > 2:
base_priority -= 350
score_differential_adjustment += 350
elif score_difference > 1:
base_priority -= 100
score_differential_adjustment += 100
if period == 3 and time_remaining <= 300:
score_differential_adjustment = score_differential_adjustment * 2
base_priority -= score_differential_adjustment
# Adjust base priority based on certain conditions
if score_difference == 0 and period == 3 and time_remaining <= 600:
@@ -121,6 +129,10 @@ def calculate_game_priority(game):
# Calculate the final priority
final_priority = int(base_priority + time_priority - matchup_adjustment + score_total)
# Pushes the games that are in intermission to the bottom, but retains their sort
if game["clock"]["inIntermission"]:
return (-2000 - time_remaining)
return final_priority
def get_team_standings(team_name):

View File

@@ -95,17 +95,17 @@ function updateGauge() {
var score = parseInt(gauge.getAttribute('data-score'));
// Clamp the score value between 0 and 700
score = Math.min(700, Math.max(0, score));
score = Math.min(650, Math.max(0, score));
// Calculate the gauge width as a percentage
var gaugeWidth = (score / 700) * 100;
var gaugeWidth = (score / 650) * 100;
// Set the width of the gauge
gauge.style.width = gaugeWidth + '%';
if (score <=350) {
if (score <=300) {
gauge.style.backgroundColor = '#4A90E2'
} else if (score <= 560) {
} else if (score <= 500) {
gauge.style.backgroundColor = '#FF4500'
} else {
gauge.style.backgroundColor = '#FF0033'

View File

@@ -7,10 +7,10 @@ body {
h1 {
text-align: center;
margin-top: 15px;
margin-bottom: 25px;
margin-top: 0.8%;
margin-bottom: 1.5%;
color: #f2f2f2;
font-size: 2em;
font-size: 2.2em;
}
.scoreboard {
@@ -26,7 +26,7 @@ h1 {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 1%;
width: 16%;
max-width: 300px;
max-width: 350px;
position: relative;
margin-left: 1%;
margin-right: 1%;
@@ -52,7 +52,7 @@ h1 {
}
.team-name {
font-size: 90%;
font-size: 1rem;
font-weight: bold;
}
@@ -64,13 +64,13 @@ h1 {
}
.team-score {
font-size: 130%;
font-size: 1.35rem;
font-weight: bold;
margin-left: auto;
}
.team-record {
font-size: 0.75rem;
font-size: 0.8rem;
font-weight: bold;
margin-left: auto;
}
@@ -83,7 +83,7 @@ h1 {
}
.team-sog {
font-size: 65%;
font-size: 0.75rem;
color: #ddd;
}
@@ -125,12 +125,12 @@ h1 {
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 0.65rem;
font-size: 0.75rem;
color: #fff;
font-weight: bolder;
z-index: 1;
width: auto;
height: 10%;
height: 7%;
display: flex;
justify-content: space-evenly;
align-items: center;
@@ -150,12 +150,15 @@ h1 {
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 65%;
font-size: 0.7rem;
color: #ddd;
z-index: 1;
font-weight: bold;
width: auto;
height: 7.5%;
height: 7%;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.live-state {
@@ -165,12 +168,12 @@ h1 {
background-color: #0b6e31;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
font-size: 0.72rem;
color: #fff;
font-weight: bolder;
z-index: 1;
width: 7.2%;
height: 7.5%;
width: 7%;
height: 7%;
display: flex;
justify-content: space-evenly;
align-items: center;
@@ -179,23 +182,23 @@ h1 {
.live-time {
position: absolute;
top: 4%;
left: 16%;
left: 15%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
font-size: 0.75rem;
color: #ddd;
z-index: 1;
display: flex;
justify-content: space-evenly;
align-items: center;
width: 10%;
height: 7.5%;
height: 7%;
}
.live-state-intermission {
position: absolute;
top: 5%;
top: 4%;
left: 4%;
background-color: #444;
padding: 1.5%;
@@ -204,8 +207,8 @@ h1 {
color: #fff;
font-weight: bolder;
z-index: 1;
width: 13%;
height: 7.5%;
width: 11%;
height: 8.5%;
display: flex;
justify-content: space-evenly;
align-items: center;
@@ -213,16 +216,16 @@ h1 {
.live-time-intermission {
position: absolute;
top: 5%;
left: 21.5%;
top: 4%;
left: 19%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
font-size: 0.75rem;
color: #ddd;
z-index: 1;
width: 12.5%;
height: 7.5%;
width: 10%;
height: 8.5%;
display: flex;
justify-content: space-evenly;
align-items: center;