Alaiy commited on
Commit
b991336
·
verified ·
1 Parent(s): fe529a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1142,7 +1142,7 @@ def fetch_and_store_data():
1142
 
1143
 
1144
  def fetch_and_store_data_market():
1145
- latest_doc = market_price_data.find_one(sort=[("Reported Date", -1)])
1146
  if latest_doc and "Reported Date" in latest_doc:
1147
  latest_date = latest_doc["Reported Date"]
1148
  else:
@@ -1157,7 +1157,7 @@ def fetch_and_store_data_market():
1157
  to_date = (datetime.now() - timedelta(days=1)).strftime('%d %b %Y')
1158
  from_date_obj = datetime.strptime(from_date, '%d %b %Y')
1159
  to_date_obj = datetime.strptime(to_date, '%d %b %Y')
1160
- if from_date_obj < to_date_obj:
1161
  print("Data already scraped")
1162
  return None
1163
  # Build the URL to be requested
 
1142
 
1143
 
1144
  def fetch_and_store_data_market():
1145
+ latest_doc = collection.find_one(sort=[("Reported Date", -1)])
1146
  if latest_doc and "Reported Date" in latest_doc:
1147
  latest_date = latest_doc["Reported Date"]
1148
  else:
 
1157
  to_date = (datetime.now() - timedelta(days=1)).strftime('%d %b %Y')
1158
  from_date_obj = datetime.strptime(from_date, '%d %b %Y')
1159
  to_date_obj = datetime.strptime(to_date, '%d %b %Y')
1160
+ if to_date_obj < from_date_obj:
1161
  print("Data already scraped")
1162
  return None
1163
  # Build the URL to be requested