Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 53a0fc7993 | |||
| a1352869ad | |||
| f059d4228b | |||
| c8f535ee48 | |||
| 65369896cc | |||
| 7e41cf4781 | |||
| 20ffd05df1 |
@@ -7,7 +7,7 @@ SCOREBOARD_DATA_FILE = 'app/data/scoreboard_data.json'
|
|||||||
def get_scoreboard_data():
|
def get_scoreboard_data():
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
start_time_evening = now.replace(hour=19, minute=00, second=0, microsecond=0) # 7:00 PM EST
|
start_time_evening = now.replace(hour=19, minute=00, second=0, microsecond=0) # 7:00 PM EST
|
||||||
end_time_evening = now.replace(hour=2, minute=00, second=0, microsecond=0) # 3:00 AM 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:
|
if now >= start_time_evening or now < end_time_evening:
|
||||||
# Use now URL
|
# Use now URL
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
def process_record(record):
|
||||||
|
if record == "N/A":
|
||||||
|
return "N/A"
|
||||||
|
else:
|
||||||
|
parts = record.split("-")
|
||||||
|
formatted_parts = [part.zfill(2) for part in parts]
|
||||||
|
return "-".join(formatted_parts)
|
||||||
|
|
||||||
def extract_game_info(scoreboard_data):
|
def extract_game_info(scoreboard_data):
|
||||||
if not scoreboard_data:
|
if not scoreboard_data:
|
||||||
return []
|
return []
|
||||||
@@ -22,8 +30,8 @@ def extract_game_info(scoreboard_data):
|
|||||||
"Intermission": game["clock"]["inIntermission"] if game_state == "LIVE" else "N/A",
|
"Intermission": game["clock"]["inIntermission"] if game_state == "LIVE" else "N/A",
|
||||||
"Priority": calculate_game_priority(game),
|
"Priority": calculate_game_priority(game),
|
||||||
"Start Time": process_start_time(game),
|
"Start Time": process_start_time(game),
|
||||||
"Home Record": game["homeTeam"]["record"] if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
"Home Record": process_record(game["homeTeam"]["record"]) if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
||||||
"Away Record": game["awayTeam"]["record"] if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
"Away Record": process_record(game["awayTeam"]["record"]) if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
||||||
"Home Shots": game["homeTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
"Home Shots": game["homeTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
||||||
"Away Shots": game["awayTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
"Away Shots": game["awayTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
||||||
"Home Power Play": get_power_play_info(game, game["homeTeam"]["name"]["default"]),
|
"Home Power Play": get_power_play_info(game, game["homeTeam"]["name"]["default"]),
|
||||||
@@ -100,11 +108,11 @@ def calculate_game_priority(game):
|
|||||||
away_total = away_team_standings["league_sequence"] + away_team_standings["league_l10_sequence"]
|
away_total = away_team_standings["league_sequence"] + away_team_standings["league_l10_sequence"]
|
||||||
|
|
||||||
# Calculate the matchup adjustment factor
|
# Calculate the matchup adjustment factor
|
||||||
matchup_multiplier = {5: 1, 4: 1, 3: 1.25, 2: 1.50, 1: 2}.get(period)
|
matchup_multiplier = {5: 1, 4: 1, 3: 1.50, 2: 1.65, 1: 2}.get(period)
|
||||||
matchup_adjustment = (home_total + away_total) * matchup_multiplier
|
matchup_adjustment = (home_total + away_total) * matchup_multiplier
|
||||||
|
|
||||||
# Calculate the base priority based on period
|
# Calculate the base priority based on period
|
||||||
base_priority = {5: 650, 4: 600, 3: 300, 2: 200}.get(period, 100)
|
base_priority = {5: 650, 4: 600, 3: 300, 2: 200}.get(period, 150)
|
||||||
|
|
||||||
# Adjust base priority based on score difference
|
# Adjust base priority based on score difference
|
||||||
score_differential_adjustment = 0
|
score_differential_adjustment = 0
|
||||||
@@ -122,8 +130,18 @@ def calculate_game_priority(game):
|
|||||||
base_priority -= score_differential_adjustment
|
base_priority -= score_differential_adjustment
|
||||||
|
|
||||||
# Adjust base priority based on certain conditions
|
# Adjust base priority based on certain conditions
|
||||||
if score_difference == 0 and period == 3 and time_remaining <= 600:
|
if period == 3 and time_remaining <= 720:
|
||||||
base_priority += 100
|
if score_difference == 0:
|
||||||
|
base_priority += 100
|
||||||
|
elif score_difference == 1:
|
||||||
|
base_priority += 60
|
||||||
|
|
||||||
|
if period == 3 and time_remaining <= 360:
|
||||||
|
if score_difference == 0:
|
||||||
|
base_priority += 50
|
||||||
|
elif score_difference == 1:
|
||||||
|
base_priority += 30
|
||||||
|
|
||||||
|
|
||||||
# Calculate time priority
|
# Calculate time priority
|
||||||
time_multiplier = {4: 2, 3: 2, 2: 1.5}.get(period, 0.75)
|
time_multiplier = {4: 2, 3: 2, 2: 1.5}.get(period, 0.75)
|
||||||
|
|||||||
@@ -95,17 +95,17 @@ function updateGauge() {
|
|||||||
var score = parseInt(gauge.getAttribute('data-score'));
|
var score = parseInt(gauge.getAttribute('data-score'));
|
||||||
|
|
||||||
// Clamp the score value between 0 and 700
|
// Clamp the score value between 0 and 700
|
||||||
score = Math.min(650, Math.max(0, score));
|
score = Math.min(700, Math.max(0, score));
|
||||||
|
|
||||||
// Calculate the gauge width as a percentage
|
// Calculate the gauge width as a percentage
|
||||||
var gaugeWidth = (score / 650) * 100;
|
var gaugeWidth = (score / 700) * 100;
|
||||||
|
|
||||||
// Set the width of the gauge
|
// Set the width of the gauge
|
||||||
gauge.style.width = gaugeWidth + '%';
|
gauge.style.width = gaugeWidth + '%';
|
||||||
|
|
||||||
if (score <=300) {
|
if (score <=300) {
|
||||||
gauge.style.backgroundColor = '#4A90E2'
|
gauge.style.backgroundColor = '#4A90E2'
|
||||||
} else if (score <= 500) {
|
} else if (score <= 550) {
|
||||||
gauge.style.backgroundColor = '#FF4500'
|
gauge.style.backgroundColor = '#FF4500'
|
||||||
} else {
|
} else {
|
||||||
gauge.style.backgroundColor = '#FF0033'
|
gauge.style.backgroundColor = '#FF0033'
|
||||||
|
|||||||
Reference in New Issue
Block a user