Compare commits

...

2 Commits

Author SHA1 Message Date
Fred Boniface f8836517c1 Bump version 2023-06-01 09:08:57 +01:00
Fred Boniface f8e3c0b8bf Add PIS 2023-06-01 09:07:57 +01:00
4 changed files with 25 additions and 6 deletions

View File

@ -2229,6 +2229,14 @@ pis:
stops: [bnp,umb,egg,lap,mrd,cop,yeo,cdi,ntc,exd,exc] stops: [bnp,umb,egg,lap,mrd,cop,yeo,cdi,ntc,exd,exc]
- code: 6143 - code: 6143
stops: [pnz,ser,hyl,cbn,red,tru,sau,par,los,lsk,men,sgm,sts,ply,ivy,tot,nta,tgm,dwl,exd,tvp,tau,bwt,hig,wsm,wnm,wor,yat,nls,psn,bmt,bri,fit,pwy,stj,nwp,cdf] stops: [pnz,ser,hyl,cbn,red,tru,sau,par,los,lsk,men,sgm,sts,ply,ivy,tot,nta,tgm,dwl,exd,tvp,tau,bwt,hig,wsm,wnm,wor,yat,nls,psn,bmt,bri,fit,pwy,stj,nwp,cdf]
- code: 8001
stops: [pnz,ser,cbn,red,tru,sau,bod,lsk,ply,tot,nta,exd,rdg,pad]
- code: 8002
stops: [pnz,ser,cbn,red,tru,sau,par,bod,lsk,ply,tot,nta,exd,tau,rdg,pad]
- code: 8003
stops: [pad,rdg,exd,nta,ply,lsk,bod,los,par,sau,tru,red,cbn,hyl,ser,pnz]
- code: 8004
stops: [pad,rdg,tau,exd,nta,ply,lsk,bod,los,par,sau,tru,red,cbn,hyl,ser,pnz]
- code: 9801 - code: 9801
stops: [pad,hxx,hwv] stops: [pad,hxx,hwv]
- code: 9802 - code: 9802

View File

@ -14,7 +14,7 @@
# program. If not, see # program. If not, see
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE # https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
version = "2023.5.10" version = "2023.6.1"
print(f"main.py: Initialising db-manager v{version}") print(f"main.py: Initialising db-manager v{version}")
#Third Party Imports #Third Party Imports

View File

@ -186,4 +186,9 @@ def putMetaHash(target :str, hash :str):
def query(collection, query): def query(collection, query):
col = db[collection] col = db[collection]
incrementCounter(collection) incrementCounter(collection)
return col.find_one(query) return col.find_one(query)
def deleteMany(collection :str, filter :dict):
col = db[collection]
incrementCounter(collection)
return col.delete_many(filter)

View File

@ -96,7 +96,7 @@ def runUpdate():
status = _insertToDb(parsed, required) status = _insertToDb(parsed, required)
if (status): if (status):
mongo.metaUpdateTime("timetable") mongo.metaUpdateTime("timetable")
log.out("timetable.runUpdate: Removing all out of date schedules", "INFO") _removeOutdatedServices()
## Check what happens if there is no update ## Check what happens if there is no update
def insertSchedule(sch_record): def insertSchedule(sch_record):
@ -181,6 +181,12 @@ def _helpParseDate(string :str, time :str = "false"):
return datetime.strptime(string, "%Y-%m-%d %H%M%S") return datetime.strptime(string, "%Y-%m-%d %H%M%S")
def _removeOutdatedServices(): def _removeOutdatedServices():
log.out("timetable._removeOutdatedServices: NOT IMPLEMENTED", "WARN") log.out("timetable._removeOutdatedServices: Removing out of date schedules", "INFO")
# Call 'delete' on all services with an end-date $lte today. preCount = mongo.getLength("timetable")
return query = {
"schedule_end_date": {
"$lte": datetime.now()
}
}
postCount = mongo.getLength("timetable")
log.out(f"timetable._removeOutdatedServices: Removed {preCount - postCount} out of date services", "DBUG")