-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Env to skip aqi data download in development #299
base: main
Are you sure you want to change the base?
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)