Add limited 'global statement' functionality (inefficient) #6
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.
No changes to the DB were made here, so I had to use a hacky way of checking whether there is a global statement: Literally check that all tasks have exactly the same .pdf statements!
Luckily, CMS already caches files, so if two files are exactly the same, then they are stored as the same file object in the DB, and we can just compare digests instead of the full files.
Note that there's some inefficiency here since many requests will now call the
get_global_statements
function which fetches several objects from the DB just to compute whether there's a global statement.