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

update: remove 'valid' paramter

parent ec169a02
No related branches found
No related tags found
1 merge request!6Clhp map
......@@ -38,10 +38,7 @@ class IceHTTP(BaseHTTPRequestHandler):
self.wfile.write(b"The root path provides no functionality. Please use a valid endpoint")
elif self.path == '/update_map': # NB: should be POST?
get_all_markers(self, self.cursor, False, 'Mjosa') # Get all markers
# NB: temporary hardcoded waterBodyName
elif self.path == '/get_valid_markers': # NB: should be POST?
get_all_markers(self, self.cursor, True, 'Mjosa') # Get only valid markers
get_all_markers(self, self.cursor, 'Mjosa') # Get all markers
# NB: temporary hardcoded waterBodyName
elif self.path == '/get_relation':
get_relation(self, 'Mjosa') # NB temp hardcoded value
......
......@@ -3,7 +3,7 @@ import json
# 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, valid: bool, waterBodyName):
def get_all_markers(self, cursor, waterBodyName):
try:
sql_query = '''
SELECT m.MeasurementID, m.SensorID, m.TimeMeasured, m.CenterLat, m.CenterLon,
......@@ -19,9 +19,6 @@ def get_all_markers(self, cursor, valid: bool, waterBodyName):
WHERE b.Name = 'Mjosa'
'''
if valid: # Append time restriction to WHERE statement, NB temporarily hardcoded to 5 days
sql_query += ' AND m.TimeMeasured > DATE_SUB(NOW(), INTERVAL 5 DAY)'
cursor.execute(sql_query)
rows = cursor.fetchall()
......@@ -63,8 +60,7 @@ def get_all_markers(self, cursor, valid: bool, waterBodyName):
'Active': bool(row[6])
},
'Subdivisions': [sub_division], # Array of sub_division objects
'Corners': [],
# Returns list of corners calculated based on center coordinates
'Corners': [], # NB remove value if not used
}
# Convert dictionary values to list of measurements
......
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