Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sara Savanovic Djordjevic
PROG2900
Commits
2a22203f
Commit
2a22203f
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
update: remove 'valid' paramter
parent
ec169a02
No related branches found
Branches containing commit
No related tags found
1 merge request
!6
Clhp map
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/main.py
+1
-4
1 addition, 4 deletions
server/main.py
server/map/get_markers.py
+2
-6
2 additions, 6 deletions
server/map/get_markers.py
with
3 additions
and
10 deletions
server/main.py
+
1
−
4
View file @
2a22203f
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
server/map/get_markers.py
+
2
−
6
View file @
2a22203f
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment