From 4ba4cbbe498537f6385861c89993f08598ad0d7e Mon Sep 17 00:00:00 2001 From: andmag <andmag@stud.ntnu.no> Date: Thu, 10 Jun 2021 11:45:28 +0200 Subject: [PATCH] Added match to endpoint --- api/endpoints/salamanderclass.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/endpoints/salamanderclass.py b/api/endpoints/salamanderclass.py index 98579f4..883e75b 100644 --- a/api/endpoints/salamanderclass.py +++ b/api/endpoints/salamanderclass.py @@ -144,9 +144,10 @@ def handle_remaining_images(salamander, salamander_path: str, image_id: int, las db.session.delete(salamander) db.session.commit() if match_bool: - return jsonify({"id": result, "matching": "Yes", 'status': 200}) + return jsonify({"id": result, "matching": "Match!", "message": "Matched with salamander", 'status': 200}) else: - return jsonify({"id": salamander.id, "matching": "No", 'status': 200}) + return jsonify( + {"id": salamander.id, "matching": "No match.", "message": "New salamander in database", 'status': 200}) else: if image_id != last_id: @@ -161,9 +162,10 @@ def handle_remaining_images(salamander, salamander_path: str, image_id: int, las os.rename(processed_path, os.path.join(salamander_path, str(image_id) + "_str" + processed_extension)) os.rename(original_path, os.path.join(salamander_path, str(image_id) + original_extension)) if match_bool: - return jsonify({"id": result, "matching": "Yes", 'status': 200}) + return jsonify({"id": result, "matching": "Match!", "message": "Matched with salamander", 'status': 200}) else: - return jsonify({"id": salamander.id, "matching": "No", 'status': 200}) + return jsonify( + {"id": salamander.id, "matching": "No match.", "message": "New salamander in database", 'status': 200}) def lower_image_id_growth_row(salamander_id, old_id, new_id): -- GitLab