Compare commits

...

5 Commits

Author SHA1 Message Date
666cc732bf feat: Style main result
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-04-18 09:27:26 +02:00
ecc3d418fc fix: remove placeholder when result is calculated 2025-04-18 09:27:12 +02:00
154f550775 fix: Cage checker
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-04-18 08:37:12 +02:00
cb71f61a91 feat: Fill yet empty result field 2025-04-18 08:27:11 +02:00
168e4acf6a fix: Round down number of rats if not int 2025-04-18 08:14:38 +02:00
4 changed files with 32 additions and 14 deletions

View File

@@ -10,7 +10,10 @@
"height-cm": "Höhe (cm)", "height-cm": "Höhe (cm)",
"full-floors": "Vollebenen", "full-floors": "Vollebenen",
"result": "Ergebnis", "result": "Ergebnis",
"input-data-num-rats": "Bitte gib erst die Maße des Käfigs ein, dann siehst du hier die Anzahl der Ratten die hineinpassen.",
"number-of-rats": "Anzahl an Ratten", "number-of-rats": "Anzahl an Ratten",
"please-input-cage-calc": "Stell ein für wie viel Ratten der Käfig sein soll, danach siehst du hier das Ergebnis.",
"please-input-cage-check": "Bitte gib erst die Maße des Käfigs und die Anzahl an Ratten ein. Danach siehst du hier, ob der Käfig passt.",
"give-feedback": "Feedback geben", "give-feedback": "Feedback geben",
"change-language": "Sprache ändern", "change-language": "Sprache ändern",
"information-on-rat-husbandry": "Information", "information-on-rat-husbandry": "Information",

View File

@@ -10,7 +10,10 @@
"height-cm": "Height (cm)", "height-cm": "Height (cm)",
"full-floors": "Full floors", "full-floors": "Full floors",
"result": "Result", "result": "Result",
"input-data-num-rats": "Please input them measurements of the cage. Then you will see the number of rats allowed.",
"number-of-rats": "Number of Rats", "number-of-rats": "Number of Rats",
"please-input-cage-calc": "First put in how many rats should fit the cage. After that come back here.",
"please-input-cage-check": "First put in how many rats should fit the cage and the cages measurements. After that come back here to see if they fit.",
"give-feedback": "Give Feedback", "give-feedback": "Give Feedback",
"change-language": "Change language", "change-language": "Change language",
"information-on-rat-husbandry": "Information", "information-on-rat-husbandry": "Information",

View File

@@ -108,10 +108,16 @@
<div class="card-footer is-fullwidth"> <div class="card-footer is-fullwidth">
<div class="card result-card" id="num-rats-result-card"> <div class="card result-card" id="num-rats-result-card">
<div class="card-header"> <div class="card-header">
<h2 class="card-header-title is-3 is-centered" data-i18n="result">Ergebnis</h2> <h2 class="card-header-title title is-2 is-centered" data-i18n="result">Ergebnis</h2>
</div> </div>
<div class="card-content"> <div class="card-content">
<div id="num-rats-resultsDiv"></div> <div class="is-size-5" id="num-rats-resultsDiv">
<p data-i18n="input-data-num-rats">
Bitte gib erst die Maße ein, dann siehst du hier die Anzahl
der Ratten die hineinpassen.
</p>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -134,10 +140,12 @@
<div class="card-footer is-fullwidth"> <div class="card-footer is-fullwidth">
<div class="card result-card" id="cage-calc-result-card"> <div class="card result-card" id="cage-calc-result-card">
<div class="card-header"> <div class="card-header">
<h2 class="card-header-title is-3 is-centered" data-i18n="result">Ergebnis</h2> <h2 class="card-header-title title is-2 is-centered" data-i18n="result">Ergebnis</h2>
</div> </div>
<div class="card-content"> <div class="card-content">
<div id="cageCalcResultsDiv"></div> <div class="is-size-5" id="cageCalcResultsDiv"></div>
<p data-i18n="please-input-cage-calc">Stell ein für wie viel Ratten der Käfig sein soll, danach
siehst du hier das Ergebnis</p>
</div> </div>
</div> </div>
</div> </div>
@@ -209,17 +217,21 @@
<div class="card-footer is-fullwidth"> <div class="card-footer is-fullwidth">
<div class="card result-card" id="result-card"> <div class="card result-card" id="result-card">
<div class="card-header"> <div class="card-header">
<h2 class="card-header-title is-3 is-centered" data-i18n="result">Ergebnis</h2> <h2 class="card-header-title title is-2 is-centered" data-i18n="result">Ergebnis</h2>
</div> </div>
<div class="card-content"> <div class="card-content">
<div id="resultsDiv"></div> <div id="resultsDiv">
<p data-i18n="please-input-cage-check">Bitte gib erst die Maße des Käfigs und die Anzahl an
Ratten ein. Danach siehst du hier, ob der Käfig passt.</p>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<button class="button is-primary floating js-modal-trigger" data-target="modal-feedback" data-i18n="give-feedback"></button> <button class="button is-primary floating js-modal-trigger" data-target="modal-feedback"
data-i18n="give-feedback"></button>
<div class="footer" aria-label="Footer"> <div class="footer" aria-label="Footer">
<div class="columns"> <div class="columns">
@@ -275,7 +287,6 @@
</div> </div>
<div id="modal-feedback" class="modal"> <div id="modal-feedback" class="modal">
<div class="modal-background"></div> <div class="modal-background"></div>

View File

@@ -346,16 +346,16 @@ function formatCriteria(criteria) {
function updateCageCheck() { function updateCageCheck() {
labelNumRats.innerHTML = i18next.t("cage-for-x-rats", {"num_rats": ratSlider.value}); labelNumRats.innerHTML = i18next.t("cage-for-x-rats", {"num_rats": ratSlider.value});
const width = inputWidth.value const width = inputWidth.value;
const depth = inputDepth.value const depth = inputDepth.value;
const height = inputHeight.value const height = inputHeight.value;
const dimensions = new Dimensions(width / 100, depth / 100, height / 100); const dimensions = new Dimensions(width / 100, depth / 100, height / 100);
const validator = new Validator(); const validator = new Validator();
const numRats = ratSlider.value; const numRats = ratSlider.value;
const numFullFloors = fullFloorNum.value; const numFullFloors = fullFloorNum.value;
const failed_checks = validator.cageCheck(dimensions, numRats,); const failed_checks = validator.cageCheck(dimensions, numRats, numFullFloors);
let resultsDiv = document.getElementById("resultsDiv"); let resultsDiv = document.getElementById("resultsDiv");
const result = getResultFromChecks(failed_checks); const result = getResultFromChecks(failed_checks);
@@ -409,7 +409,7 @@ function updateNumRatsCalculator() {
const validator = new Validator(); const validator = new Validator();
const failed_checks = validator.failCageNumberIndependent(dimensions, numFullFloors); const failed_checks = validator.failCageNumberIndependent(dimensions, numFullFloors);
let overallArea = validator.getOverallArea(dimensions, ); let overallArea = validator.getOverallArea(dimensions, numFullFloors);
let allowedNumRats; let allowedNumRats;
try { try {
allowedNumRats = validator.allowedNumberOfRats(overallArea); allowedNumRats = validator.allowedNumberOfRats(overallArea);
@@ -426,7 +426,8 @@ function updateNumRatsCalculator() {
resultsDiv.innerHTML = ""; resultsDiv.innerHTML = "";
const p = document.createElement('p'); 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)});
p.className = " is-size-5 has-text-weight-semibold"
resultsDiv.appendChild(p); resultsDiv.appendChild(p);
resultsDiv.appendChild(result); resultsDiv.appendChild(result);