-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues writing files_array to GCS (#3)
Fix issues writing files_array to GCS The immediate error that we saw was that `ReportDetails.report` was `None`. I believe that's because we were not passing the `current_report_row` when creating the `ReportDetails` (see `services/report/__init__.py` changes). We had a similar issue a couple lines down before. That case slipped by. To avoid further issues we will default to writing data to the DB if we can't access the repository from the `ReportDetails` object. Then because my env does save reports to GCS I noticed differences between saving data in DB vs GCS. The difference is that the constituent parts of `files_array` in DB returned the classes they belong to (idk how), vs the encoded data that comes back from GCS (json format). In theory that is not an issue, because both formats are pretty much interchangeable, but the less differnces the better. SO I introduced a rehydrate function that wraps the `files_array` in the classes they are supposed to be. Using the hydration function we can better standarize the data that is returned when accessing `ReportDetails.files_array`. The difference was mostly within a Session when you set `files_array` in the DB you still use the data you had before. Differently, when setting it to storage you always get back the encoded data, because it goes to storage immediatelly. By standarizing the return we make sure to always use the appropriate inner classes, regardless of where the data comes from.
- Loading branch information
1 parent
454d352
commit 0bf5dc2
Showing
4 changed files
with
204 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.