diff --git a/src/timetable.py b/src/timetable.py index 27f3774..b4ef9bc 100644 --- a/src/timetable.py +++ b/src/timetable.py @@ -149,8 +149,8 @@ def _insertToDb(data :list, type :str): elif type == "update": for item in data: if item['transactionType'] == "Create": - singleList = [item] - mongo.putTimetable(singleList) + singleList = [item] ### These items should be stored in a list and only + mongo.putTimetable(singleList) ### Put into the databse AFTER deletions. elif item['transactionType'] == "Delete": mongo.deleteTimetableData({'trainUid': item['trainUid'], 'scheduleStartDate': item['scheduleStartDate'], 'stpIndicator': item['stpIndicator']}) ## Also need to consider the STP indicator and end date here else I am deleting LTP services when an STP is meant to be deleted. post_count = mongo.getLength("timetable")