Apply manual prices to budget rating

This commit is contained in:
2026-07-01 11:18:00 +02:00
parent 6cf8906798
commit ac7ba88422
6 changed files with 84 additions and 17 deletions
+15 -3
View File
@@ -134,14 +134,26 @@ function rateBudget(product, preferences) {
}
const share = product.price / preferences.maxBudgetPerShoppingTrip;
const periodLabel = budgetPeriodLabel(preferences.budgetPeriod);
if (share <= 0.08) {
return { status: 'good', message: 'Preis passt gut zu deinem Einkaufsbudget.' };
return { status: 'good', message: `Preis passt gut zu deinem Budget pro ${periodLabel}.` };
}
if (share <= 0.18) {
return { status: 'medium', message: 'Preis ist spürbar, aber noch im Rahmen.' };
return { status: 'medium', message: `Preis ist für dein Budget pro ${periodLabel} spürbar, aber noch im Rahmen.` };
}
return { status: 'critical', message: 'Preis belastet dein Einkaufsbudget stark.' };
return { status: 'critical', message: `Preis belastet dein Budget pro ${periodLabel} stark.` };
}
function budgetPeriodLabel(period) {
const labels = {
day: 'Tag',
week: 'Woche',
month: 'Monat',
shoppingTrip: 'Einkauf'
};
return labels[period] || labels.week;
}