Skip to content
Snippets Groups Projects
Commit f489dd9c authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

add: Corner class, app

parent 697f06a1
No related branches found
No related tags found
No related merge requests found
......@@ -70,4 +70,24 @@ class Data {
accuracy: json['Accuracy'],
);
}
}
class Corner {
double cornerID;
double latitude;
double longitude;
Corner({
required this.cornerID,
required this.latitude,
required this.longitude,
});
factory Corner.fromJson(Map<String, dynamic> json) {
return Corner(
cornerID: json['CornerID'],
latitude: json['CornerLatitude'],
longitude: json['CornerLongitude'],
);
}
}
\ No newline at end of file
No preview for this file type
......@@ -63,22 +63,22 @@ def get_all_markers(self, cursor):
if len(rows) == 0 or len(data) == 0: # Return 500 and empty list if no data is found
print(f"An error occurred while querying the database")
resp_code = 500
marker_json = '[]'
marker_data = '[]'
else:
resp_code = 200
# Convert list of dictionaries to JSON
marker_json = json.dumps(data, indent=4)
marker_data = json.dumps(data, indent=4)
except Exception as e:
print(f"An error occurred while querying the database: {e}")
resp_code = 500
marker_json = '[]'
marker_data = '[]'
# Set headers
self.send_response(resp_code)
self.send_header("Content-type", "application/json")
self.end_headers()
# Write marker_data to the response object
self.wfile.write(marker_json.encode('utf-8'))
# Write marker data to the response object
self.wfile.write(marker_data.encode('utf-8'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment