fix: Round down number of rats if not int

This commit is contained in:
moanos [he/him] 2025-04-18 08:14:38 +02:00
parent cfe305e698
commit 168e4acf6a

View File

@ -409,7 +409,7 @@ function updateNumRatsCalculator() {
const validator = new Validator();
const failed_checks = validator.failCageNumberIndependent(dimensions, numFullFloors);
let overallArea = validator.getOverallArea(dimensions, );
let overallArea = validator.getOverallArea(dimensions, numFullFloors);
let allowedNumRats;
try {
allowedNumRats = validator.allowedNumberOfRats(overallArea);
@ -426,7 +426,7 @@ function updateNumRatsCalculator() {
resultsDiv.innerHTML = "";
const p = document.createElement('p');
p.textContent = i18next.t("cage-for-x-rats", {"num_rats": allowedNumRats});
p.textContent = i18next.t("cage-for-x-rats", {"num_rats": Math.floor(allowedNumRats)});
resultsDiv.appendChild(p);
resultsDiv.appendChild(result);