Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1320 | reference cascade to use unique reso…
Browse files Browse the repository at this point in the history
…urces
  • Loading branch information
snyaggarwal committed Jun 24, 2022
1 parent c639f65 commit 3620a05
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,12 @@ def get_concepts(self, system_version=None):
queryset |= result['concepts']
mapping_queryset |= result['mappings']

# distinct is to eliminate self mappings
queryset = Concept.objects.filter(
id__in=queryset.values_list('id', flat=True).distinct('versioned_object_id'))
mapping_queryset = Mapping.objects.filter(
id__in=mapping_queryset.values_list('id', flat=True).distinct('versioned_object_id'))

if self.should_apply_filter():
queryset = self.apply_filters(queryset, Concept)
if self.should_transform_to_latest_version():
Expand Down

0 comments on commit 3620a05

Please sign in to comment.