fix: cage selector
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
moanos [he/him] 2024-07-20 08:47:41 +02:00
parent 6b964c81a8
commit 04dc1e6b90

View File

@ -14,34 +14,34 @@
<div class="cage-selector"> <div class="cage-selector">
<div class="card"> <div class="card">
<div class="card-photo"> <div class="card-photo">
<input type="checkbox" id="selectSavicSuiteRoyleXL"/> <input type="checkbox" id="SavicSuiteRoyaleXL"/>
<div> <div>
<img src="assets/img/savic-xl.jpeg"> <img src="assets/img/savic-xl.jpeg">
</div> </div>
</div> </div>
<label for="selectSavicSuiteRoyleXL"> Savic Suite Royale XL</label> <label for="SavicSuiteRoyaleXL"> Savic Suite Royale XL</label>
</div> </div>
<div class="card"> <div class="card">
<div class="card-photo"> <div class="card-photo">
<input type="checkbox" id="selectSavicSuiteRoyle95Double"/> <input type="checkbox" id="SavicSuiteRoyale95Double"/>
<div> <div>
<img src="assets/img/savic-95-double.jpg"> <img src="assets/img/savic-95-double.jpg">
</div> </div>
</div> </div>
<label for="selectSavicSuiteRoyle95Double">Savic Suite Royale 95 Double</label> <label for="SavicSuiteRoyale95Double">Savic Suite Royale 95 Double</label>
</div> </div>
<div class="card"> <div class="card">
<div class="card-photo"> <div class="card-photo">
<input type="checkbox" id="selectTiakiKleintierkäfigEtagere"/> <input type="checkbox" id="TiakiKleintierkäfigEtagere"/>
<div> <div>
<img src="assets/img/tiaki.jpeg"> <img src="assets/img/tiaki.jpeg">
</div> </div>
</div> </div>
<label for="selectTiakiKleintierkäfigEtagere">TIAKI Kleintierkäfig Étagère</label> <label for="TiakiKleintierkäfigEtagere">TIAKI Kleintierkäfig Étagère</label>
</div> </div>
<div class="card"> <div class="card">
@ -95,27 +95,31 @@
const selectSavicSuiteRoyleXL = document.getElementById("selectSavicSuiteRoyleXL"); const selectSavicSuiteRoyaleXL = document.getElementById("SavicSuiteRoyaleXL");
const selectSavicSuiteRoyle95Double = document.getElementById("selectSavicSuiteRoyle95Double"); const selectSavicSuiteRoyale95Double = document.getElementById("SavicSuiteRoyale95Double");
const selectTiakiKleintierkäfigEtagere = document.getElementById("selectTiakiKleintierkäfigEtagere"); const selectTiakiKleintierkäfigEtagere = document.getElementById("TiakiKleintierkäfigEtagere");
function updateCage(selectedCage) { function updateCage(event) {
selectSavicSuiteRoyleXL.checked = false; console.log("dada");
selectSavicSuiteRoyle95Double.checked = false; selectSavicSuiteRoyaleXL.checked = false;
selectSavicSuiteRoyale95Double.checked = false;
selectTiakiKleintierkäfigEtagere.checked = false; selectTiakiKleintierkäfigEtagere.checked = false;
const selectedCage = event.currentTarget
selectedCage.checked = true; selectedCage.checked = true;
const cageName = selectedCage.id; const cageName = selectedCage.id;
const dim = getCageDimensions(cageName);
console.log(cageName);
var dim = getCageDimensions(cageName);
inputWidth.value = dim.width; inputWidth.value = dim.width;
inputDepth.value = dim.depth; inputDepth.value = dim.depth;
inputHeight.value = dim.height; inputHeight.value = dim.height;
update();
} }
selectSavicSuiteRoyleXL.onselect = updateCage;
selectSavicSuiteRoyle95Double.onselect = updateCage; selectSavicSuiteRoyaleXL.onchange = updateCage;
selectTiakiKleintierkäfigEtagere.onselect = updateCage; selectSavicSuiteRoyale95Double.onchange = updateCage;
selectTiakiKleintierkäfigEtagere.onchange = updateCage;
var labelNumRats = document.getElementById("labelNumRats"); var labelNumRats = document.getElementById("labelNumRats");
@ -133,14 +137,15 @@
var fullFloorNum = document.getElementById("numFullFloors"); var fullFloorNum = document.getElementById("numFullFloors");
function getCageDimensions(cageName) { function getCageDimensions(cageName) {
console.log(cageName);
if (cageName == "SavicSuiteRoyaleXL") { if (cageName == "SavicSuiteRoyaleXL") {
return new Dimensions(1, 0.5, 1); return new Dimensions(115, 67.5, 153);
} }
if (cageName == "SavicSuiteRoyale95Double") { if (cageName == "SavicSuiteRoyale95Double") {
return new Dimensions(1, 0.5, 1); return new Dimensions(95, 63, 120);
} }
if (cageName == "TiakiKleintierkäfigEtagere") { if (cageName == "TiakiKleintierkäfigEtagere") {
return new Dimensions(1, 0.5, 1); return new Dimensions(93.5, 63, 141.2);
} }
} }
@ -163,12 +168,13 @@
} }
function update() { function update() {
const width = inputWidth.value / 100 const width = inputWidth.value
const depth = inputDepth.value / 100 const depth = inputDepth.value
const height = inputHeight.value / 100 const height = inputHeight.value
const dimensions = new Dimensions(width, depth, height) const dimensions = new Dimensions(width/100, depth/100, height/100);
var failed_checks = cageCheck(dimensions, ratSlider.value, fullFloorNum.value); const failed_checks = cageCheck(dimensions, ratSlider.value, fullFloorNum.value);
var resultsDiv = document.getElementById("resultsDiv"); console.log(failed_checks);
let resultsDiv = document.getElementById("resultsDiv");
resultsDiv.innerHTML = `<strong>Ergebnis</strong>`; resultsDiv.innerHTML = `<strong>Ergebnis</strong>`;
const result = getResultFromChecks(failed_checks); const result = getResultFromChecks(failed_checks);