Bugfix/fix sqlite holidays and excess data #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sqlite
This fixes the issue where the sqlite database was not getting populated by anything other than the base_price table.
In sqlite, an INSERT statement implicitly opens a transaction, which needs to be committed before changes are saved in the database.
I added the commit command to do so and updated the documentation.
Duplicating data on each
sqlite
connectionEvery time the code connects to a sqlite database, it adds the same data to the database.
This is one way to fix that by trying to query the last piece of data expected in the database. If it's there, it returns early. Otherwise it'll run the code to add all the data.
Fix: holidays throw "string has no attribute year"
When a request is for a day pass and has a date, the logic it tries to compare the request's date to the date that comes from the database.
However, when sqlite pulls data out of the database, it's a string. It needs to be converted to a datetime object.
This is one way to fix this issue. I'm very open to other suggestions.