Update environment configuration and enhance logging: Add support for loading a local .env file and improve logging behavior based on QUIET_ENV_LOGS settings. Introduce new diagnostic scripts in package.json for town worth and money flow analysis. Adjust production cost calculations in FalukantService to align with updated pricing logic and enhance product initialization parameters.

This commit is contained in:
Torsten Schulz (local)
2026-03-25 13:23:51 +01:00
parent 44991743d2
commit 8af726c65a
15 changed files with 498 additions and 46 deletions

View File

@@ -0,0 +1,38 @@
-- Karotte: Debug-Tempo und Preis an gleiche Basis wie andere Kat.-1-Waren (siehe initializeFalukantPredefines.js).
-- Sicher für alle Installationen: nur production_time ohne optionale Spalten.
BEGIN;
UPDATE falukant_type.product
SET production_time = 2
WHERE label_tr = 'carrot';
COMMIT;
-- Optional (wenn Migration mit original_sell_cost läuft): in derselben Session ausführen
/*
UPDATE falukant_type.product
SET original_sell_cost = 6
WHERE label_tr = 'carrot';
WITH RECURSIVE ancestors AS (
SELECT id AS start_id, id, parent_id, tax_percent FROM falukant_data.region
UNION ALL
SELECT a.start_id, r.id, r.parent_id, r.tax_percent
FROM falukant_data.region r
JOIN ancestors a ON r.id = a.parent_id
), totals AS (
SELECT start_id, COALESCE(SUM(tax_percent), 0) AS total FROM ancestors GROUP BY start_id
), mm AS (
SELECT COALESCE(MAX(total), 0) AS max_total FROM totals
)
UPDATE falukant_type.product p
SET sell_cost = CEIL(p.original_sell_cost * (
CASE WHEN (1 - mm.max_total / 100) <= 0 THEN 1 ELSE (1 / (1 - mm.max_total / 100)) END
))
FROM mm
WHERE p.label_tr = 'carrot' AND p.original_sell_cost IS NOT NULL;
*/
-- Ohne original_sell_cost: grob sell_cost = 6 (wie Milch/Brot; ggf. anpassen)
-- UPDATE falukant_type.product SET sell_cost = 6 WHERE label_tr = 'carrot';