From feb9c9f712612de652bf31c97cd46dac648973b0 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 12 Dec 2025 12:11:07 +0000
Subject: [PATCH] Address code review feedback: use constants for deduction
values
Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
---
Dienstplan_Portable.html | 8 ++++----
webapp/app.js | 10 +++++-----
webapp/calculator.js | 5 +++--
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/Dienstplan_Portable.html b/Dienstplan_Portable.html
index 0d8931f..3b84e6c 100644
--- a/Dienstplan_Portable.html
+++ b/Dienstplan_Portable.html
@@ -1301,12 +1301,12 @@ class DienstplanApp {
let note = '';
if (!thresholdReached) {
- note = `${safeName} erreicht die Mindestschwelle nicht (${we_total.toFixed(1)} von 2,0 WE-Einheiten) und erhält daher keine Bonuszahlung.`;
+ note = `${safeName} erreicht die Mindestschwelle nicht (${we_total.toFixed(1)} von ${CONFIG.THRESHOLD.toFixed(1)} WE-Einheiten) und erhält daher keine Bonuszahlung.`;
} else {
- const paid_we = we_total - 1.0;
+ const paid_we = we_total - CONFIG.DEDUCTION;
let breakdown = [];
- if (data.wt > 0) breakdown.push(`${data.wt.toFixed(1)} WT-Einheiten à 250 €`);
- if (paid_we > 0) breakdown.push(`${paid_we.toFixed(1)} WE-Einheiten à 450 €`);
+ if (data.wt > 0) breakdown.push(`${data.wt.toFixed(1)} WT-Einheiten à ${CONFIG.RATE_WT} €`);
+ if (paid_we > 0) breakdown.push(`${paid_we.toFixed(1)} WE-Einheiten à ${CONFIG.RATE_WE} €`);
note = `${safeName} erhält eine Bonuszahlung von ${this.formatCurrency(bonus)}`;
if (breakdown.length > 0) {
diff --git a/webapp/app.js b/webapp/app.js
index dd97592..b03568f 100644
--- a/webapp/app.js
+++ b/webapp/app.js
@@ -738,7 +738,7 @@ class DienstplanApp {
if (thresholdReached) {
const wt_pay = data.wt * this.calculator.RATE_NORMAL;
- let deduct = 1.0;
+ let deduct = this.calculator.DEDUCTION_AMOUNT;
const deduct_fr = Math.min(deduct, data.we_fr);
const deduct_other = Math.max(0, deduct - deduct_fr);
const paid_fr = Math.max(0, data.we_fr - deduct_fr);
@@ -762,12 +762,12 @@ class DienstplanApp {
let note = '';
if (!thresholdReached) {
- note = `${safeName} erreicht die Mindestschwelle nicht (${we_total.toFixed(1)} von 2,0 WE-Einheiten) und erhält daher keine Bonuszahlung.`;
+ note = `${safeName} erreicht die Mindestschwelle nicht (${we_total.toFixed(1)} von ${this.calculator.MIN_QUALIFYING_DAYS.toFixed(1)} WE-Einheiten) und erhält daher keine Bonuszahlung.`;
} else {
- const paid_we = we_total - 1.0;
+ const paid_we = we_total - this.calculator.DEDUCTION_AMOUNT;
let breakdown = [];
- if (data.wt > 0) breakdown.push(`${data.wt.toFixed(1)} WT-Einheiten à 250 €`);
- if (paid_we > 0) breakdown.push(`${paid_we.toFixed(1)} WE-Einheiten à 450 €`);
+ if (data.wt > 0) breakdown.push(`${data.wt.toFixed(1)} WT-Einheiten à ${this.calculator.RATE_NORMAL} €`);
+ if (paid_we > 0) breakdown.push(`${paid_we.toFixed(1)} WE-Einheiten à ${this.calculator.RATE_WEEKEND} €`);
note = `${safeName} erhält eine Bonuszahlung von ${this.calculator.formatCurrency(bonus)}`;
if (breakdown.length > 0) {
diff --git a/webapp/calculator.js b/webapp/calculator.js
index bc5c787..2dd855b 100644
--- a/webapp/calculator.js
+++ b/webapp/calculator.js
@@ -8,6 +8,7 @@ class BonusCalculator {
this.RATE_NORMAL = 250; // Normal day rate (not weekend/holiday)
this.RATE_WEEKEND = 450; // Weekend/holiday rate
this.MIN_QUALIFYING_DAYS = 2.0; // Minimum qualifying days to trigger bonus
+ this.DEDUCTION_AMOUNT = 1.0; // Deduction after reaching threshold
}
/**
@@ -108,8 +109,8 @@ class BonusCalculator {
let totalDeduction = 0;
if (thresholdReached) {
- // Deduct 1.0 qualifying day with Friday priority
- totalDeduction = 1.0;
+ // Deduct qualifying days with Friday priority
+ totalDeduction = this.DEDUCTION_AMOUNT;
// First deduct from Friday
deductionFromFriday = Math.min(totalDeduction, qualifyingDaysFriday);