Skip to content

Commit

Permalink
#52 filter out 0 and >= 999
Browse files Browse the repository at this point in the history
  • Loading branch information
Nik Sauer committed Dec 6, 2024
1 parent 046eeec commit e24af81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/routers/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ async def get_topn_stations_by_dim(
output_format: OutputFormat = Query(OutputFormat.CSV, description="Ouput format"),
db: Session = Depends(get_db)
):

LOWER_BOUND = 0
UPPER_BOUND = 999
compare = Values.value
if order == Order.MAX:
compare = Values.value.desc()
Expand All @@ -305,6 +306,8 @@ async def get_topn_stations_by_dim(
.join(Values, Values.measurement_id == Measurement.id)
.filter(Station.last_active == Measurement.time_measured)
.filter(Values.dimension == dimension)
.filter(Values.value > LOWER_BOUND)
.filter(Values.value < UPPER_BOUND)
.order_by(compare)
.limit(n)
)
Expand Down

0 comments on commit e24af81

Please sign in to comment.