From 13bfa30123029aeb3c2482356b3474c509844b6e Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Tue, 13 Feb 2024 11:36:34 +0100 Subject: [PATCH] fix: color parsing problem --- app/lib/pages/marker_data.dart | 1 + server/__pycache__/consts.cpython-311.pyc | Bin 595 -> 595 bytes .../__pycache__/data_structs.cpython-311.pyc | Bin 3945 -> 3945 bytes server/main.py | 3 --- .../__pycache__/get_markers.cpython-311.pyc | Bin 2626 -> 2627 bytes server/map/get_markers.py | 8 ++++---- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/lib/pages/marker_data.dart b/app/lib/pages/marker_data.dart index 1c3d6150..19ddbc8c 100644 --- a/app/lib/pages/marker_data.dart +++ b/app/lib/pages/marker_data.dart @@ -113,6 +113,7 @@ class MarkerTemplate { // parseColor parses the color strings into Colors types static Color parseColor(String colorString) { + colorString = colorString.toLowerCase(); switch (colorString) { case 'yellow': return Colors.yellow; diff --git a/server/__pycache__/consts.cpython-311.pyc b/server/__pycache__/consts.cpython-311.pyc index b7f2592f2239ee05fd4207b4e5c35e5e08689ba6..a23af0c5b3845ffae15470851a5140633c3e1e1a 100644 GIT binary patch delta 20 acmcc2a+!sDIWI340}%XnIlYnFg9!jUDFu}P delta 20 acmcc2a+!sDIWI340}xoUoZ86k!2|#`Rs@m& diff --git a/server/__pycache__/data_structs.cpython-311.pyc b/server/__pycache__/data_structs.cpython-311.pyc index e071b1d60a2ebf539fbf43547a01ca60a2060165..1712fda5bb5d5052467d229040d3b28b5994c237 100644 GIT binary patch delta 20 acmaDU_fn2~IWI340}%XnIlYlPjvoL+P6ikN delta 20 acmaDU_fn2~IWI340}xoUoZ848#}5EJdj%B$ diff --git a/server/main.py b/server/main.py index ace59dd7..750a0555 100644 --- a/server/main.py +++ b/server/main.py @@ -1,10 +1,7 @@ from flask import Flask, jsonify from http.server import HTTPServer, BaseHTTPRequestHandler -from pymongo import MongoClient -from pymongo.server_api import ServerApi from consts import DB_NAME, COLLECTION, MONGO_URI, MONGO_CERT_PATH, SSL_CERT_PATH, SSL_KEY_PATH, HOST, PORT from map.get_markers import get_markers -import atexit import ssl import keyboard diff --git a/server/map/__pycache__/get_markers.cpython-311.pyc b/server/map/__pycache__/get_markers.cpython-311.pyc index c218b600d9e5fb7a7e15ffd566a376b1d63f53a9..59fa0684c37365cbc66b2600abcee50b3d1d9de8 100644 GIT binary patch delta 365 zcmX>ka#)0SIWI340}zC`o=)wX$g6LZ!jQt0!<5S$#hl9$#gfY!#hS|&#m2}06lcz1 z&*g~XU}Q*T$l?TP0)Yiw6Bi0AGNf`ZV`N}h4a5)-#e<@V7pRCIRUaQvh?^mmCxvAh z6Hq79<OR%P0#W>_j7Vk+0M)26r1GPh4Rj1^3qzD(3S%&XCfiGpg?^J=7;RXpnDq2E zH!v<_k#o5q1wtFxW|+;ln`L)VTKkH$Hbe|aPPS)T$j(`kT3iyJviTWX6{D6YR|n@; zJ_Z4io+^l{9hyM;qLj-OAj$7~h2Ql+@dbXb3mjgPyEqajn{et*e#PNAIg!(4@_SCx X$xArB<UVjnGm3p+z$A(^fer)!s@Yf7 delta 440 zcmX>sa!7=CIWI340}xoUoJ#GP$g5wU%8<nb5&(e(%n%xtOl4Wd$iT1~h#??~6-5sl zOdOd;QNfNZ17oMMrZ6pIVwiYes-7d25y=glFcrvjDhH|?7#UI+QkZkNa=D|pb9th8 za(Sb8bNQn9z~U@9{J8>A0zfuv3qzD(3S%&XCfiGpaeh@ydU~2Hx43;%6N^iWQgc)D zN^VUKVAR>%z_^e_&iR5A2yI}SVK(1xmfb~Z?JLsS5HTP**`9478%IfMaf!?3=WJDs zS|VH>9AEhu1VnnOAc}Tq0O^ZT&R2jWzsnVVmjlTc_&qOhcuwx-NSrLi=`r~=hu-8Q jPM67dI6WC}OkU3^HTeLiwA=>{X-2UR446cbCeYCUmkL?e diff --git a/server/map/get_markers.py b/server/map/get_markers.py index 1bcb9100..8280418a 100644 --- a/server/map/get_markers.py +++ b/server/map/get_markers.py @@ -1,10 +1,10 @@ import os import sys +from data_structs import Measurement, Sensor, MarkerTemplate, DateAndTime +from flask import json current_dir = os.path.dirname(__file__) parent_dir = os.path.abspath(os.path.join(current_dir, '..')) sys.path.append(parent_dir) -from data_structs import Measurement, Sensor, MarkerTemplate, DateAndTime -from flask import json # get_markers parses a list of MarkerTemplate objects to json, and returns either a successfully # parsed json object with status code 200, or and error message and status code 501 @@ -25,14 +25,14 @@ def get_markers(): measurement3 = Measurement(longitude=10.8471, latitude=60.7366, datetime=datetime3, sensor=sensor1, precipitation=0.0, thickness=0.0, max_weight=0.0, safety_level=0.0, accuracy=4.0) - testData = [ + test_data = [ MarkerTemplate(measurement1, 30.0-measurement1.accuracy, "green"), MarkerTemplate(measurement2, 10.0-measurement2.accuracy, "red"), MarkerTemplate(measurement3, 20.0-measurement3.accuracy, "yellow"), ] # NB: return test data as JSON - return json.dumps([marker.to_dict() for marker in testData]), 200 + return json.dumps([marker.to_dict() for marker in test_data]), 200 except Exception as e: return e, 500 \ No newline at end of file -- GitLab