diff --git a/app/lib/pages/default_page.dart b/app/lib/pages/default_page.dart index 3e14bd8d682d5138acf4f0e975e6d6bc2c66e624..dcce804ada048bcea5ea57c6423b98984a3dd8c6 100644 --- a/app/lib/pages/default_page.dart +++ b/app/lib/pages/default_page.dart @@ -64,6 +64,7 @@ class _DefaultPageState extends State<DefaultPage> { // Make request only if the selected lake is different from the current selected lake if (result != selectedLake) { setState(() { + print("SetState called!"); selectedLake = result; }); initialiseState(false); diff --git a/app/lib/widgets/choropleth_map.dart b/app/lib/widgets/choropleth_map.dart index 173f860e1daa68a20596f2fcfe8168238824eb06..c4db7cefaeb20dcefd80dbc2a78ec3aefde705b1 100644 --- a/app/lib/widgets/choropleth_map.dart +++ b/app/lib/widgets/choropleth_map.dart @@ -86,6 +86,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> { @override Widget build(BuildContext context) { + print("Map built!"); return Stack( children: [ SfMapsTheme( diff --git a/server/main.py b/server/main.py index 566e64f3b264417040c9093b41fce3a3ea31c8d9..b5da7f0b78f59f4ffbd10e5abc9d213dd210986d 100644 --- a/server/main.py +++ b/server/main.py @@ -9,7 +9,7 @@ from http.server import HTTPServer, BaseHTTPRequestHandler from map_handler.add_lake import cut_map from server.consts import LAKE_RELATIONS_PATH from map_handler.get_lake_relation import get_divided_map -from map_handler.get_measurements import get_all_markers +from map_handler.get_measurements import get_measurements from map_handler.input_new_data import input_new_Lidar_data app = Flask(__name__) @@ -60,14 +60,20 @@ class IceHTTP(BaseHTTPRequestHandler): self.send_response(500) self.send_header('Content-type', 'application/json') self.end_headers() - elif self.path.startswith('/update_map'): # NB: should be POST? + elif self.path.startswith('/update_map'): parsed_path = urlparse(self.path) query_params = parse_qs(parsed_path.query) lake_name_param = query_params.get('lake', [''])[0] lake_name = unquote(lake_name_param) # Decode url param - get_all_markers(self, self.cursor, lake_name) # Get all markers + if lake_name_param: + get_measurements(self, self.cursor, lake_name) # Get all markers + else: + self.send_response(400) + self.send_header('Content-type', 'application/json') + self.end_headers() + # NB: temporary hardcoded waterBodyName elif self.path.startswith('/get_relation'): parsed_path = urlparse(self.path) diff --git a/server/map_handler/__pycache__/get_lake_relation.cpython-311.pyc b/server/map_handler/__pycache__/get_lake_relation.cpython-311.pyc index 15407de3dee5ad887f2b1a901bf523fecd0dc368..ef3d31476ac6b46bf3c3895ef031e3a381892b01 100644 Binary files a/server/map_handler/__pycache__/get_lake_relation.cpython-311.pyc and b/server/map_handler/__pycache__/get_lake_relation.cpython-311.pyc differ diff --git a/server/map_handler/__pycache__/get_measurements.cpython-311.pyc b/server/map_handler/__pycache__/get_measurements.cpython-311.pyc index 4428ea3d1cf7782690c3cd887061ae76458f248e..ee5e1ccdccee14f7ee06c06ae61235dc7dc00a14 100644 Binary files a/server/map_handler/__pycache__/get_measurements.cpython-311.pyc and b/server/map_handler/__pycache__/get_measurements.cpython-311.pyc differ diff --git a/server/map_handler/get_measurements.py b/server/map_handler/get_measurements.py index c97becd2044123e9b60725c11bc4a0f17323d2c7..21c5505a01b672f432b7fbc074454c5da9a20a32 100644 --- a/server/map_handler/get_measurements.py +++ b/server/map_handler/get_measurements.py @@ -5,8 +5,9 @@ from datetime import datetime # get_markers requests all marker data or valid markers, converts the data to json, and writes # the data to the response object -def get_all_markers(self, cursor, lake_name): +def get_measurements(self, cursor, lake_name): try: + print("Lake name in get_measurements: ", lake_name) sql_query = ''' SELECT m.MeasurementID, m.SensorID, m.TimeMeasured, m.CenterLat, m.CenterLon, s.SensorType, s.Active,