Last active
December 13, 2022 15:57
-
-
Save nvlaarhoven/41d4348e362d4764f7496cf9d02ca963 to your computer and use it in GitHub Desktop.
Being able to generate report with different comparison group
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
https://dabapps.mydonedone.com/issuetracker/projects/45387/issues/1470 | |
// In order to let user regenerate a report with a different comparison group, we need to delete the `ReportGenerationBatch` from the database. | |
// The following worked because the report generation was on `manual` rather than `auto` and the activity only had `1` `ActivityProductVersion` | |
from project.assets.models.activities import Activity | |
activity = Activity.objects.get(id='f252ddd8-4f9c-4b0d-ad2e-698e74db6e79') | |
activity_product_version = activity.activity_product_version_items.get() | |
emails = ['[email protected]', '[email protected]', '[email protected]'] | |
activity_product_version.reportgenerationbatch_set.filter(session__user__email__in=emails).count() | |
// In this case there is exactly 1 `ReportGenerationBatch` for each user, so we can just delete these. | |
// If there was more than 1, more investigation would be needed | |
activity_product_version.reportgenerationbatch_set.filter(session__user__email__in=emails).delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment