Skip to content

Commit

Permalink
glamr/load: Fix missing sync of access columns during data loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert102 committed Dec 11, 2024
1 parent 7ed87b2 commit f67b68a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mibios/glamr/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,15 @@ def split_by_comma(self, value, obj):
)

def load(self, *args, **kwargs):
"""
Load Dataset records from the datasets/studies google sheet
"""
# avoid circular import:
self.staff_group_name = import_string('mibios.glamr.accounts.STAFF_GROUP_NAME') # noqa:E501
self.skipped = []
super().load(*args, **kwargs)
if connections['default'].vendor == 'postgresql':
self.model.objects.update_access()
skipped_ids = [getattr(i, 'dataset_id', None) for i in self.skipped]
qs = self.filter(dataset_id__in=skipped_ids)
if qs.exists():
Expand Down Expand Up @@ -523,6 +528,8 @@ def load_meta(self, **kwargs):
for key, field_list in get_sample_blocklist().items()
}
self.load(**kwargs)
if connections['default'].vendor == 'postgresql':
self.model.objects.update_access()
flag = SampleTracking.Flag.METADATA
for i in self._saved_samples:
tr, new = SampleTracking.objects.get_or_create(sample=i, flag=flag)
Expand Down

0 comments on commit f67b68a

Please sign in to comment.