Update check_table_name function to pass tests

This commit is contained in:
chris committed 2026-03-05 18:40:53 -05:00
1 parent f4adb27cc6
commit 3e6cb29425
1 file changed
+21 -3
+21 -3
View File
@@ -3,17 +3,35 @@
Utility functions for drawing data processing Utility functions for drawing data processing
""" """
import os
from datetime import datetime, timedelta from datetime import datetime, timedelta
from dotenv import load_dotenv
from data.database import PowerballDraw, MegaMillionsDraw from data.database import PowerballDraw, MegaMillionsDraw
load_dotenv()
def check_table_name(table_name: str) -> bool:
def check_table_name(table_name: str) -> dict | None:
""" """
:param table_name: table name :param table_name: table name
:return: True if table name is valid :return: dict of game info or None
""" """
return table_name in ['PowerballDraw', 'MegaMillionsDraw'] game_dict: dict = {
'PowerballDraw': {
'game_name': 'powerball',
'db_table_name': 'powerball_draws',
'inception_year': os.getenv('LP_POWERBALL_INCEPTION'),
},
'MegaMillionsDraw': {
'game_name': 'mega-millions',
'db_table_name': 'mega_millions_draws',
'inception_year': os.getenv('LP_MEGA_MILLIONS_INCEPTION'),
},
}
return game_dict[table_name] if table_name in game_dict.keys() else None
def get_next_draw_date(game: str | None, from_date: str | None = None) -> str | None: def get_next_draw_date(game: str | None, from_date: str | None = None) -> str | None: