Env to skip aqi data download in development - #299
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #299 +/- ##
==========================================
- Coverage 80.55% 78.97% -1.59%
==========================================
Files 55 55
Lines 1445 1460 +15
Branches 169 175 +6
==========================================
- Hits 1164 1153 -11
- Misses 257 280 +23
- Partials 24 27 +3
|
JoJoensuu
left a comment
There was a problem hiding this comment.
Maybe write a test to see that scoring works if air_quality is not fetched (eg. air quality is 0)?
Some nitpicking about redundant code.
Otherwise looks good and logical.
| if weather_data.get('air_quality'): | ||
| data['Score'] = scorer.score( | ||
| weather_data['temperature'], weather_data['wind_speed'], | ||
| weather_data['humidity'], weather_data['precipitation'], | ||
| weather_data['clouds'], weather_data['air_quality'], | ||
| sunrise_time, sunset_time, current_time | ||
| ) | ||
| else: | ||
| data['Score'] = scorer.score( | ||
| weather_data['temperature'], weather_data['wind_speed'], | ||
| weather_data['humidity'], weather_data['precipitation'], | ||
| weather_data['clouds'], 0, | ||
| sunrise_time, sunset_time, current_time | ||
| ) |
There was a problem hiding this comment.
There's some duplicate code here that could be refactored.
For example:
`temperature = weather_data.get('temperature')
wind_speed = weather_data.get('wind_speed')
humidity = weather_data.get('humidity')
precipitation = weather_data.get('precipitation')
clouds = weather_data.get('clouds')
air_quality = weather_data.get('air_quality', 0)
data['Score'] = scorer.score(
temperature, wind_speed, humidity, precipitation, clouds, air_quality,
sunrise_time, sunset_time, current_time
)`
Add this line to local backend .env file to skip aqi data download in development:
ENVIRONMENT = "development"
(or anything that's not "production" really)