Skip to content

Commit

Permalink
Merge pull request #658 from OpenImaging/fix-reset-demo
Browse files Browse the repository at this point in the history
Fix reset demo logic
  • Loading branch information
zachmullen authored Dec 4, 2023
2 parents b1b2051 + f5d8bff commit b8ad2f4
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions miqa/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,21 @@ def _download_from_s3(path: str, public: bool) -> bytes:

@shared_task
def reset_demo():
demo_project = Project.objects.get(name='Demo Project')
demo_project.import_path = 's3://miqa-storage/miqa.csv'
demo_project.export_path = 'samples/demo.json'
demo_project.save()
demo_user = User.objects.get(username='[email protected]')
demo_project, created = Project.objects.get_or_create(
name='Demo Project',
defaults={
'creator': demo_user,
'import_path': 's3://miqa-storage/IXI_demo.csv',
'export_path': 'samples/demo.json',
},
)
if not created:
demo_project.creator = demo_user
demo_project.import_path = 's3://miqa-storage/IXI_demo.csv'
demo_project.export_path = 'samples/demo.json'
demo_project.save()

import_data(demo_project.id)
Project.objects.exclude(id=demo_project.id).delete()

Expand Down

0 comments on commit b8ad2f4

Please sign in to comment.