Skip to content

Commit

Permalink
added extra condition to prevent ovewriting of pre-exisitng analysis_…
Browse files Browse the repository at this point in the history
…summary_json data
  • Loading branch information
MGS-sails committed Sep 19, 2023
1 parent 24cbf5b commit b3636bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion emgapianns/management/commands/import_analysis_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ def handle(self, *args, **options):

for analysis_job in analysis_jobs:
analysis_summary = analysis_job.analysis_summary
if analysis_summary:
if analysis_summary and not analysis_job.analysis_summary_json:
analysis_job.analysis_summary_json = analysis_summary
updated_records.append(analysis_job)

if updated_records:
AnalysisJob.objects.bulk_update(updated_records, ['analysis_summary_json'])

self.stdout.write(self.style.SUCCESS(f'Values copied successfully for batch {batch_number}.'))
self.stdout.write(self.style.SUCCESS(f'Updated {len(updated_records)} records.'))
except AnalysisJob.DoesNotExist:
self.stdout.write(self.style.ERROR('AnalysisJob table does not exist or is empty.'))

0 comments on commit b3636bd

Please sign in to comment.