-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Bug in Weather Units for Broadcasted Notification #3519
Bug in Weather Units for Broadcasted Notification #3519
Conversation
…mperial method and add comments
Thanks! Can you please add an entry to the |
if you need help to fix the lint errors in the failed test let me know |
Some of the problem is doing npm run install-mm doesn’t install the git commit hooks |
I resolve eslint errors. |
from the test: yes, you introduced |
looks like a typo:
|
Thanks very much for your time and help, my mistake is that I skipped running tests, because I was working on Windows system. |
*/ | ||
convertPrecipitationToInch (value, valueUnit) { | ||
if (valueUnit && valueUnit.toLowerCase() === "cm") return value * 0.3937007874; | ||
else return value * 0.03937007874; |
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.
this else code does the same as the if part?
and why not use the convertPrecipitationUnit method?
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.
the code inside if converts cm to inch and the code inside else converts mm to inch.
The reason that I added convertPrecipitationToInch ()
method is that convertPrecipitationUnit()
returns a string, and I think that maybe we need the raw value of precipitation.
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.
sorry for late reply and my first wrong response...
i get your point, will add a small improvement myself and approve
*/ | ||
convertPrecipitationToInch (value, valueUnit) { | ||
if (valueUnit && valueUnit.toLowerCase() === "cm") return value * 0.3937007874; | ||
else return value * 0.03937007874; |
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.
sorry for late reply and my first wrong response...
i get your point, will add a small improvement myself and approve
This PR resolve Issue number #3419 .
I have added the method
convertWeatherObjectToImperial()
which converts the units of thenotificationPayload
to imperial if needed, in order to pass the object insendNotification()
.