Compare commits

...

2 Commits

Author SHA1 Message Date
9dfc567d5c feat: use min-width in px
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-07-23 21:52:10 +02:00
093d0c0997 feat: Add minimum short side length rule 2024-07-23 21:52:10 +02:00
2 changed files with 15 additions and 8 deletions

View File

@ -1,15 +1,17 @@
const MINIMUM_BASE_AREA = 0.5; const MINIMUM_BASE_AREA = 0.5;
const MINIMUM_AREA_THREE_RATS = 1.8; const MINIMUM_AREA_THREE_RATS = 1.5;
const AREA_PER_ADDITIONAL_RAT = 0.2; const AREA_PER_ADDITIONAL_RAT = 0.25;
const MAXIMUM_FALL_HEIGHT = 0.5; const MAXIMUM_FALL_HEIGHT = 0.5;
const MINIMUM_LENGTH = 0.8; const MINIMUM_LENGTH_LONG_SIDE = 0.8;
const MINIMUM_LENGTH_SHORT_SIDE = 0.5;
const MINIMUM_FLOOR_HEIGHT = 0.3; const MINIMUM_FLOOR_HEIGHT = 0.3;
const FAILED_BASE_AREA = "base_area"; const FAILED_BASE_AREA = "base_area";
const FAILED_OVERALL_AREA = "overall_area"; const FAILED_OVERALL_AREA = "overall_area";
const FAILED_FALL_HEIGHT = "fall_height"; const FAILED_FALL_HEIGHT = "fall_height";
const FAILED_NUM_RATS = "num_rats"; const FAILED_NUM_RATS = "num_rats";
const FAILED_LENGTH = "length"; const FAILED_MINIMUM_LENGTH_LONG_SIDE = "length_long_side";
const FAILED_MINIMUM_LENGTH_SHORT_SIDE= "length_short_side";
const FAILED_FLOOR_HEIGHT = "floor_height" const FAILED_FLOOR_HEIGHT = "floor_height"
const FAIL_CRITERIA = { const FAIL_CRITERIA = {
@ -18,7 +20,8 @@ const FAIL_CRITERIA = {
[FAILED_FALL_HEIGHT]: `Die mögliche Fallhöhe darf nicht mehr als ${(MAXIMUM_FALL_HEIGHT * 100).toFixed(0)}cm betragen.`, [FAILED_FALL_HEIGHT]: `Die mögliche Fallhöhe darf nicht mehr als ${(MAXIMUM_FALL_HEIGHT * 100).toFixed(0)}cm betragen.`,
[FAILED_FLOOR_HEIGHT]: `Der Mindestabstand zwischen Ebenen muss ${(MINIMUM_FLOOR_HEIGHT * 100).toFixed(0)}cm betragen.`, [FAILED_FLOOR_HEIGHT]: `Der Mindestabstand zwischen Ebenen muss ${(MINIMUM_FLOOR_HEIGHT * 100).toFixed(0)}cm betragen.`,
[FAILED_NUM_RATS]: "Es müssen mindestens 3 Ratten zusammenleben, Paarhaltung ist nicht artgerecht.", [FAILED_NUM_RATS]: "Es müssen mindestens 3 Ratten zusammenleben, Paarhaltung ist nicht artgerecht.",
[FAILED_LENGTH]: `Eine Seite des Käfig muss mindestens ${(MINIMUM_LENGTH * 100).toFixed(0)}cm lang sein um Rennen zu ermöglichen.`, [FAILED_MINIMUM_LENGTH_LONG_SIDE]: `Die lange Seite des Käfig muss mindestens ${(MINIMUM_LENGTH_LONG_SIDE * 100).toFixed(0)}cm lang sein um Rennen zu ermöglichen.`,
[FAILED_MINIMUM_LENGTH_SHORT_SIDE]: `Die kurze Seite des Käfig muss mindestens ${(MINIMUM_LENGTH_SHORT_SIDE * 100).toFixed(0)}cm lang sein.`,
}; };
class Dimensions { class Dimensions {
@ -66,8 +69,12 @@ function cageCheck(dimensions, numRats, numFullFloors) {
failedCriteria[FAILED_FALL_HEIGHT] = FAIL_CRITERIA[FAILED_FALL_HEIGHT]; failedCriteria[FAILED_FALL_HEIGHT] = FAIL_CRITERIA[FAILED_FALL_HEIGHT];
} }
if (dimensions.width < MINIMUM_LENGTH && dimensions.depth < MINIMUM_LENGTH) { if (dimensions.width < MINIMUM_LENGTH_LONG_SIDE && dimensions.depth < MINIMUM_LENGTH_LONG_SIDE) {
failedCriteria[FAILED_LENGTH] = FAIL_CRITERIA[FAILED_LENGTH]; failedCriteria[FAILED_MINIMUM_LENGTH_LONG_SIDE] = FAIL_CRITERIA[FAILED_MINIMUM_LENGTH_LONG_SIDE];
}
if (dimensions.width < MINIMUM_LENGTH_SHORT_SIDE || dimensions.depth < MINIMUM_LENGTH_SHORT_SIDE) {
failedCriteria[FAILED_MINIMUM_LENGTH_SHORT_SIDE] = FAIL_CRITERIA[FAILED_MINIMUM_LENGTH_SHORT_SIDE];
} }
if (dimensions.height / numFullFloors < MINIMUM_FLOOR_HEIGHT) { if (dimensions.height / numFullFloors < MINIMUM_FLOOR_HEIGHT) {

View File

@ -144,7 +144,7 @@ label {
border-radius: 10px; border-radius: 10px;
} }
@media screen and (min-width: 40em) { @media screen and (min-width: 800px) {
flex: 0 1 calc(25% - 0.5em); flex: 0 1 calc(25% - 0.5em);
} }