Bug Fixes:
- Out of date schedules were not being removed from timetable - Timetable update was at risk of missing a day - cif-data file was not being removed after mailing - mainly an issue when not containerized - Added additional helper variables
This commit is contained in:
parent
bfe15ca776
commit
0f7693d798
@ -84,5 +84,4 @@ def onlyStations(data):
|
||||
workingList.append(workingDict)
|
||||
postLength = len(workingList)
|
||||
log.out(f"corpus.onlyStations: Removed {preLength - postLength} documents", "INFO")
|
||||
log.out(f"Yes, I am aware there are not {postLength} stations but the data includes NI, TfL, some bus, tram and closed stations too","OTHR")
|
||||
return workingList
|
@ -16,7 +16,8 @@ pis_file_paths = [
|
||||
corpus_data_url = "https://publicdatafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS"
|
||||
|
||||
## Time Constants
|
||||
one_day_in_seconds = 84600
|
||||
one_day_in_seconds = (60**2)*24
|
||||
twenty_hours = (60**2)*20
|
||||
two_day_in_seconds = one_day_in_seconds * 2
|
||||
two_weeks_in_seconds = one_day_in_seconds * 14
|
||||
|
||||
|
@ -47,6 +47,11 @@ def deleteLogs():
|
||||
print("Tidied log file")
|
||||
else:
|
||||
print("No logfile to tidy")
|
||||
if os.path.exists("cif_data"):
|
||||
os.remove("cif_data")
|
||||
print("Removed cif_data file")
|
||||
else:
|
||||
print("No cif_data to tidy")
|
||||
|
||||
|
||||
def sendMail(msg_body :str, retry):
|
||||
|
@ -14,7 +14,7 @@
|
||||
# program. If not, see
|
||||
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
|
||||
|
||||
version = "2023.6.9"
|
||||
version = "2023.6.10"
|
||||
print(f"main.py: Initialising db-manager v{version}")
|
||||
|
||||
#Third Party Imports
|
||||
|
@ -53,7 +53,7 @@ def isUpdateRequired():
|
||||
if (timetableDataAge >= helpers.two_day_in_seconds and isAfter0800) or REBUILD:
|
||||
log.out(f"timetable.isUpdateRequired: timetable collection requires rebuild", "INFO")
|
||||
return "full"
|
||||
if (timetableDataAge >= helpers.one_day_in_seconds and isAfter0800):
|
||||
if (timetableDataAge >= helpers.twenty_hours and isAfter0800):
|
||||
log.out(f"timetable.isUpdateRequired: timetable collection requires update", "INFO")
|
||||
return "update"
|
||||
return False
|
||||
@ -205,8 +205,8 @@ def _removeOutdatedServices():
|
||||
log.out("timetable._removeOutdatedServices: Removing out of date schedules", "INFO")
|
||||
pre_count = mongo.getLength("timetable")
|
||||
query = {
|
||||
"schedule_end_date": {
|
||||
"$lte": datetime.now()
|
||||
"scheduleEndDate": {
|
||||
"$lt": now
|
||||
}
|
||||
}
|
||||
mongo.deleteMany("timetable", query)
|
||||
|
Reference in New Issue
Block a user