Skip to content

Commit

Permalink
Updated measurements endpoint with new timezone column statement
Browse files Browse the repository at this point in the history
  Also added test to catch the underlying issue
  • Loading branch information
caparker committed Nov 15, 2024
1 parent d98396f commit a5435f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openaq_api/openaq_api/v3/routers/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ async def sensor_yearly_get(


async def fetch_measurements(query, db):

query.set_column_map({"timezone": "tz.tzid"})

sql = f"""
SELECT m.sensors_id
, value
Expand Down
4 changes: 4 additions & 0 deletions openaq_api/tests/test_sensor_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def test_default_good(self, client):
data = json.loads(response.content).get('results', [])
assert len(data) > 0, "response did not have at least one record"

def test_date_filter_good(self, client):
response = client.get(f"/v3/sensors/{sensors_id}/measurements?datetime_from=2023-03-06")
assert response.status_code == 200

def test_aggregated_hourly_good(self, client):
response = client.get(f"/v3/sensors/{sensors_id}/measurements/hourly")
assert response.status_code == 200
Expand Down

0 comments on commit a5435f1

Please sign in to comment.