Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1922 Fixing owner_type to lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Dec 6, 2024
1 parent c7c0de9 commit 97e23fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/code_systems/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def create(self, validated_data):
ident = IdentifierSerializer.include_ocl_identifier(uri, RESOURCE_TYPE, validated_data)
source = SourceCreateOrUpdateSerializer().prepare_object(validated_data)

if ident['owner_type'] in ['orgs', 'Organization']:
if ident['owner_type'].lower() in ['orgs', 'organization']:
owner = Organization.objects.filter(mnemonic=ident['owner_id']).first()
else:
owner = UserProfile.objects.filter(username=ident['owner_id']).first()
Expand Down
2 changes: 1 addition & 1 deletion core/concept_maps/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def create(self, validated_data):
ident = IdentifierSerializer.include_ocl_identifier(uri, RESOURCE_TYPE, validated_data)
source = SourceCreateOrUpdateSerializer().prepare_object(validated_data)

if ident['owner_type'] in ['orgs', 'Organization']:
if ident['owner_type'].lower() in ['orgs', 'organization']:
owner = Organization.objects.filter(mnemonic=ident['owner_id']).first()
else:
owner = UserProfile.objects.filter(username=ident['owner_id']).first()
Expand Down
2 changes: 1 addition & 1 deletion core/value_sets/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def create(self, validated_data):
collection.version = HEAD
collection.collection_type = 'ValueSet'

parent_klass = Organization if ident['owner_type'] in ['orgs', 'Organization'] else UserProfile
parent_klass = Organization if ident['owner_type'].lower() in ['orgs', 'organization'] else UserProfile
collection.set_parent(parent_klass.objects.filter(**{parent_klass.mnemonic_attr: ident['owner_id']}).first())

user = self.context['request'].user
Expand Down

0 comments on commit 97e23fe

Please sign in to comment.