Skip to content
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

Merged
merged 13 commits into from
Aug 18, 2024

Conversation

skpanagiotis
Copy link
Contributor

@skpanagiotis skpanagiotis commented Aug 4, 2024

This PR resolve Issue number #3419 .

I have added the method convertWeatherObjectToImperial() which converts the units of the notificationPayload to imperial if needed, in order to pass the object in sendNotification().

@khassel
Copy link
Collaborator

khassel commented Aug 4, 2024

Thanks! Can you please add an entry to the CHANGELOG.md file? (otherwise the tests will fail ...)

@khassel
Copy link
Collaborator

khassel commented Aug 4, 2024

if you need help to fix the lint errors in the failed test let me know

@sdetweil
Copy link
Collaborator

sdetweil commented Aug 4, 2024

Some of the problem is doing npm run install-mm doesn’t install the git commit hooks

@skpanagiotis
Copy link
Contributor Author

I resolve eslint errors.
Is there a possibility that the failed tests are due to my code?

@khassel
Copy link
Collaborator

khassel commented Aug 5, 2024

from the test: "Error: Uncaught [SyntaxError: Identifier 'WeatherObject' has already been declared]\n"

yes, you introduced const WeatherObject = require("./weatherobject"); but in the tests we have in file weather_object_spec.js the same variable name const WeatherObject = require ... so renaming one of them should solve this

@khassel
Copy link
Collaborator

khassel commented Aug 5, 2024

looks like a typo:

convertPrecipitationToInch vs. this.convertPerticipationToInch

@skpanagiotis
Copy link
Contributor Author

Thanks very much for your time and help, my mistake is that I skipped running tests, because I was working on Windows system.

@khassel khassel requested a review from rejas August 5, 2024 20:38
modules/default/weather/weatherutils.js Outdated Show resolved Hide resolved
modules/default/weather/weatherutils.js Outdated Show resolved Hide resolved
@khassel khassel requested a review from rejas August 5, 2024 21:53
*/
convertPrecipitationToInch (value, valueUnit) {
if (valueUnit && valueUnit.toLowerCase() === "cm") return value * 0.3937007874;
else return value * 0.03937007874;
Copy link
Collaborator

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?

Copy link
Contributor Author

@skpanagiotis skpanagiotis Aug 6, 2024

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.

Copy link
Collaborator

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;
Copy link
Collaborator

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

@rejas rejas merged commit 5673678 into MagicMirrorOrg:develop Aug 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants