Skip to content

Commit

Permalink
Added validation for the case the header is not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
lrdossan committed Nov 14, 2023
1 parent 0a712a4 commit aecd532
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions caimira/apps/calculator/static/js/co2_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function uploadFile(endpoint) {
const cellValue = worksheet[headerCoordinates[header]]?.v;
if (
!cellValue ||
$.type(cellValue) !== "string" ||
cellValue.trim().toLowerCase() !== header.toLowerCase()
) {
$("#upload-error")
Expand Down
4 changes: 2 additions & 2 deletions caimira/tests/apps/calculator/test_model_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def test_ventilation_window_hepa(baseline_form: model_generator.FormData):
@pytest.mark.parametrize(
["activity", "total_people", "infected_people", "error"],
[
['office', 10, 11, "Number of infected people cannot be more or equal than number of total people."],
['office', 10, 10, "Number of infected people cannot be more or equal than number of total people."],
['office', 10, 11, "Number of infected people cannot be greater or equal to the number of total people"],
['office', 10, 10, "Number of infected people cannot be greater or equal to the number of total people"],
['training', 10, 2, "Conference/Training activities are limited to 1 infected."],
]
)
Expand Down

0 comments on commit aecd532

Please sign in to comment.