James McCool commited on
Commit
6401015
·
1 Parent(s): c5993eb

Refactor date handling in init_conn function of app.py. Updated date retrieval to parse dates into datetime objects for improved consistency and accuracy in data analysis. This change enhances the reliability of date-related operations in the application.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -14,8 +14,8 @@ def init_conn():
14
  db = client["League_of_Legends_Database"]
15
 
16
  collection = db["gamelogs"]
17
- min_date = collection.find_one({}, sort=[("date", 1)])["date"]
18
- max_date = collection.find_one({}, sort=[("date", -1)])["date"]
19
  team_names = collection.distinct("teamname")
20
  player_names = collection.distinct("playername")
21
 
 
14
  db = client["League_of_Legends_Database"]
15
 
16
  collection = db["gamelogs"]
17
+ min_date = datetime.strptime(collection.find_one({}, sort=[("date", 1)])["date"], "%Y-%m-%d")
18
+ max_date = datetime.strptime(collection.find_one({}, sort=[("date", -1)])["date"], "%Y-%m-%d")
19
  team_names = collection.distinct("teamname")
20
  player_names = collection.distinct("playername")
21