Skip to content

Commit

Permalink
front: fix decimals error for project budget
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Macron <[email protected]>
  • Loading branch information
Akctarus committed Nov 15, 2024
1 parent f05eecf commit cc50c8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion front/public/locales/en/operationalStudies/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"objectives": "goals",
"openStudy": "Open",
"projectBudget": "Estimated budget",
"projectBudgetInvalid": "The budget for the project must not exceed 2147483647",
"projectBudgetInvalid": "The project budget must be a positive integer and must not exceed 2147483647",
"projectCancel": "Cancel",
"projectCreateButton": "Create project",
"projectCreationTitle": "Create a project",
Expand Down
2 changes: 1 addition & 1 deletion front/public/locales/fr/operationalStudies/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"objectives": "objectifs",
"openStudy": "Ouvrir",
"projectBudget": "Budget estimé",
"projectBudgetInvalid": "Le budget du projet ne doit pas dépasser 2147483647",
"projectBudgetInvalid": "Le budget du projet doit être un entier positif et ne doit pas dépasser 2147483647",
"projectCancel": "Annuler",
"projectCreateButton": "Créer le projet",
"projectCreationTitle": "Créer un projet",
Expand Down
4 changes: 3 additions & 1 deletion front/src/modules/project/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const checkProjectFields = (
objectives: isInvalidString(TEXT_AREA_MAX_LENGTH, project.objectives),
description: isInvalidString(SMALL_TEXT_AREA_MAX_LENGTH, project.description),
funders: isInvalidString(TEXT_INPUT_MAX_LENGTH, project.funders),
budget: (project.budget ?? 0) > 2147483647,
budget:
(project.budget ?? 0) > 2147483647 ||
(!Number.isInteger(project.budget) && project.budget !== null),
});

export default checkProjectFields;

0 comments on commit cc50c8a

Please sign in to comment.