Skip to content

Instantly share code, notes, and snippets.

View nvlaarhoven's full-sized avatar

Narani van Laarhoven nvlaarhoven

View GitHub Profile
@nvlaarhoven
nvlaarhoven / trialsiteuser.txt
Last active March 28, 2024 13:44
Novo - Adding Site User to Trial
from project.trialsites.models import TrialSite, TrialSiteUser
from project.accounts.models import User
email = '*****@nhs.net'
trial_id = 'EX6018-4915'
site_reference = '5413'
user = User.objects.get(email=email)
trial_site = TrialSite.objects.get(site_reference=site_reference, trial__global_trial_id=trial_id)
@nvlaarhoven
nvlaarhoven / Enable - Delete ReportGenerationBatch
Last active December 13, 2022 15:57
Being able to generate report with different comparison group
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 = ['michael.j.anderton@gmail.com', 'loader.mark1@gmail.com', 'paramoresimon@yahoo.co.uk']
activity_product_version.reportgenerationbatch_set.filter(session__user__email__in=emails).count()