Spaces:
Running
Running
michaelkri commited on
Commit ·
cd1329d
1
Parent(s): edd46d3
Corrected update time calculation
Browse files- app/main.py +2 -2
app/main.py
CHANGED
|
@@ -9,7 +9,7 @@ import os
|
|
| 9 |
from datetime import datetime, timedelta
|
| 10 |
|
| 11 |
|
| 12 |
-
DEFAULT_UPDATE_INTERVAL =
|
| 13 |
|
| 14 |
|
| 15 |
# set update interval from environment variable if available
|
|
@@ -77,7 +77,7 @@ async def read_root(request: Request, background_tasks: BackgroundTasks):
|
|
| 77 |
)
|
| 78 |
|
| 79 |
# how many hours since the last update
|
| 80 |
-
last_updated_hours = (datetime.now() - articles[0].date).
|
| 81 |
|
| 82 |
return templates.TemplateResponse(
|
| 83 |
'index.html',
|
|
|
|
| 9 |
from datetime import datetime, timedelta
|
| 10 |
|
| 11 |
|
| 12 |
+
DEFAULT_UPDATE_INTERVAL = 8 # in hours
|
| 13 |
|
| 14 |
|
| 15 |
# set update interval from environment variable if available
|
|
|
|
| 77 |
)
|
| 78 |
|
| 79 |
# how many hours since the last update
|
| 80 |
+
last_updated_hours = int((datetime.now() - articles[0].date).total_seconds() // 3600)
|
| 81 |
|
| 82 |
return templates.TemplateResponse(
|
| 83 |
'index.html',
|