Skip to content

Commit

Permalink
Merge pull request #292 from hotosm/hotfix/status-code-training
Browse files Browse the repository at this point in the history
HOTFIX : Status code on the training publish endpoint
  • Loading branch information
kshitijrajsharma authored Oct 17, 2024
2 parents 55d160c + 558c24a commit 03f002a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class DatasetViewSet(
class TrainingSerializer(
serializers.ModelSerializer
): # serializers are used to translate models objects to api

user = UserSerializer(read_only=True)
multimasks = serializers.BooleanField(required=False, default=False)
input_contact_spacing = serializers.IntegerField(
required=False, default=8, min_value=0, max_value=20
Expand Down Expand Up @@ -729,10 +729,10 @@ def publish_training(request, training_id: int):
training_instance = get_object_or_404(Training, id=training_id)

if training_instance.status != "FINISHED":
return Response("Training is not FINISHED", status=404)
return Response("Training is not FINISHED", status=409)
if training_instance.accuracy < 70:
return Response(
"Can't publish the training since its accuracy is below 70%", status=404
"Can't publish the training since its accuracy is below 70%", status=403
)

model_instance = get_object_or_404(Model, id=training_instance.model.id)
Expand Down

0 comments on commit 03f002a

Please sign in to comment.