Skip to content

Commit 0a2250e

Browse files
committed
[Bug] Allows integer start and end time
1 parent 0d9aa31 commit 0a2250e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

backend/routes/projects.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def add_segmentations(project_id, data_id, segmentation_id=None):
535535
if start_time is None or end_time is None:
536536
return jsonify(message="Params `start_time` or `end_time` missing"), 400
537537

538-
if type(start_time) is not float or type(end_time) is not float:
538+
if not (isinstance(start_time, (int, float)) or isinstance(end_time, (int, float))):
539539
return (
540540
jsonify(
541541
message="Params `start_time` and `end_time` need to be float values"
@@ -546,8 +546,8 @@ def add_segmentations(project_id, data_id, segmentation_id=None):
546546
transcription = request.json.get("transcription", None)
547547
annotations = request.json.get("annotations", dict())
548548

549-
start_time = round(start_time, 4)
550-
end_time = round(end_time, 4)
549+
start_time = round(float(start_time), 4)
550+
end_time = round(float(end_time), 4)
551551

552552
try:
553553
request_user = User.query.filter_by(username=identity["username"]).first()

0 commit comments

Comments
 (0)