Skip to content

Commit

Permalink
Merge pull request #203 from dimagi/ce/null-api
Browse files Browse the repository at this point in the history
use method to set default
  • Loading branch information
calellowitz authored Nov 22, 2023
2 parents 3d30255 + 85e803b commit 06cb220
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions commcare_connect/opportunity/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class CommCareAppSerializer(serializers.ModelSerializer):
organization = serializers.SlugRelatedField(read_only=True, slug_field="slug")
learn_modules = LearnModuleSerializer(many=True)
install_url = serializers.SerializerMethodField()
passing_score = serializers.IntegerField(default=-1)
description = serializers.CharField(default="")
passing_score = serializers.SerializerMethodField()

class Meta:
model = CommCareApp
Expand All @@ -45,6 +44,11 @@ class Meta:
def get_install_url(self, obj):
return f"{settings.COMMCARE_HQ_URL}/a/{obj.cc_domain}/apps/download/{obj.cc_app_id}/media_profile.ccpr"

def get_passing_score(self, obj):
if obj.passing_score is None:
return -1
return obj.passing_score


class OpportunityClaimSerializer(serializers.ModelSerializer):
class Meta:
Expand Down

0 comments on commit 06cb220

Please sign in to comment.