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] Improper handling of number rounding #328

Open
jeafreezy opened this issue Feb 13, 2025 · 1 comment
Open

[BUG] Improper handling of number rounding #328

jeafreezy opened this issue Feb 13, 2025 · 1 comment
Assignees
Labels

Comments

@jeafreezy
Copy link
Collaborator

Describe the bug

Currently, production is down due to the improper handling of numbers. This is not happening in development, which means it could be that the backend is not returning a number somewhere.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://fair.hotosm.org.
  2. See error.

Expected behavior

Everything should work fine as before.

Screenshots

Screenshot 2025-02-13 at 10 16 42

Desktop (please complete the following information):

  • OS: Mac
  • Browser: Chrome
@jeafreezy jeafreezy added the bug Something isn't working label Feb 13, 2025
@jeafreezy jeafreezy self-assigned this Feb 13, 2025
@jeafreezy
Copy link
Collaborator Author

It appears that the number rounding is not the major cause of the bug, but rather the assumption that the environment variable 'VITE_MIN_TRAINING_AREA_SIZE' will be a number.

It was configured for the first time in the recent deployment.

It is used here:

aoiAreaInstruction: `Area should be > ${formatAreaInAppropriateUnit(MIN_TRAINING_AREA_SIZE)} and < ${formatAreaInAppropriateUnit(MAX_TRAINING_AREA_SIZE)}.`,

Meanwhile formatAreaInAppropriateUnit expects a number:

export const formatAreaInAppropriateUnit = (area: number): string => {
if (area > 1000000) {
return roundNumber(area / 1000000, 1).toLocaleString() + "km²";
}
return roundNumber(area, 1).toLocaleString() + "m²";

The solution will be to better handle environmental variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant