Skip to content

Commit

Permalink
fix(detections): allow azimuth=0 for the detection table (#414)
Browse files Browse the repository at this point in the history
* fix(detections): allow azimuth=0

* test(detections): add a test case
  • Loading branch information
frgfm authored Jan 16, 2025
1 parent 3ac2cd1 commit ccd95d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/api/api_v1/endpoints/detections.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def create_detection(
min_length=2,
max_length=settings.MAX_BBOX_STR_LENGTH,
),
azimuth: float = Form(..., gt=0, lt=360, description="angle between north and direction in degrees"),
azimuth: float = Form(..., ge=0, lt=360, description="angle between north and direction in degrees"),
file: UploadFile = File(..., alias="file"),
detections: DetectionCRUD = Depends(get_detection_crud),
webhooks: WebhookCRUD = Depends(get_webhook_crud),
Expand Down
2 changes: 1 addition & 1 deletion src/app/schemas/detections.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DetectionLabel(BaseModel):
class Azimuth(BaseModel):
azimuth: float = Field(
...,
gt=0,
ge=0,
lt=360,
description="angle between north and direction in degrees",
json_schema_extra={"examples": [110]},
Expand Down
2 changes: 2 additions & 0 deletions src/tests/endpoints/test_detections.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
(None, 0, {"azimuth": 45.6, "bboxes": []}, 422, None),
(None, 1, {"azimuth": 45.6, "bboxes": (0.6, 0.6, 0.6, 0.6, 0.6)}, 422, None),
(None, 1, {"azimuth": 45.6, "bboxes": "[(0.6, 0.6, 0.6, 0.6, 0.6)]"}, 422, None),
(None, 1, {"azimuth": 360, "bboxes": "[(0.6,0.6,0.7,0.7,0.6)]"}, 422, None),
(None, 1, {"azimuth": 45.6, "bboxes": "[(0.6,0.6,0.7,0.7,0.6)]"}, 201, None),
(None, 1, {"azimuth": 0, "bboxes": "[(0.6,0.6,0.7,0.7,0.6)]"}, 201, None),
],
)
@pytest.mark.asyncio
Expand Down

0 comments on commit ccd95d2

Please sign in to comment.