Update production log SQL queries to include completion count: Modified the QUERY_INSERT_UPDATE_PRODUCTION_LOG to add a new completion_count field, ensuring accurate tracking of completed productions. Updated related documentation to reflect changes in production counting logic and SQL migrations.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m51s
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m51s
This commit is contained in:
16
migrations/015_falukant_log_production_completion_count.sql
Normal file
16
migrations/015_falukant_log_production_completion_count.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- Abgeschlossene Produktionen für Zertifikat: pro tatsächlichem Abschluss +1 (UPSERT erhöht Menge,
|
||||
-- ohne diese Spalte bliebe COUNT(*) der Log-Zeilen bei zusammengefassten Tageszeilen falsch niedrig).
|
||||
|
||||
ALTER TABLE falukant_log.production
|
||||
ADD COLUMN IF NOT EXISTS completion_count integer;
|
||||
|
||||
UPDATE falukant_log.production
|
||||
SET completion_count = 1
|
||||
WHERE completion_count IS NULL;
|
||||
|
||||
ALTER TABLE falukant_log.production
|
||||
ALTER COLUMN completion_count SET DEFAULT 1,
|
||||
ALTER COLUMN completion_count SET NOT NULL;
|
||||
|
||||
COMMENT ON COLUMN falukant_log.production.completion_count IS
|
||||
'Anzahl abgeschlossener Produktionen in dieser aggregierten Log-Zeile; beim Einfügen 1, bei Konflikt +1 pro Abschluss (YpDaemon produce, Zertifikat: SUM(completion_count)).';
|
||||
@@ -37,3 +37,7 @@ Spalte **`falukant_data.falukant_user.last_political_daily_salary_on`** (Datum):
|
||||
## `014_falukant_certificate_productions_count_since.sql`
|
||||
|
||||
Spalte **`falukant_data.falukant_user.certificate_productions_count_since`**: Zertifikats-**Produktionszählung** (Mindestwerte + Produktionspunkte) ab diesem Zeitpunkt; Daemon setzt bei **Aufstieg/Bankrott/Erbfolge** auf `NOW()`. **`NULL`** = bis zur ersten Änderung weiterhin alle passenden Log-Zeilen zählen.
|
||||
|
||||
## `015_falukant_log_production_completion_count.sql`
|
||||
|
||||
Spalte **`falukant_log.production.completion_count`**: zählt **abgeschlossene Produktionen** pro aggregierter Log-Zeile (bei gleichem Tag/Produkt/Region wird die Menge per UPSERT summiert; ohne `completion_count` bliebe `COUNT(*)` über die Zeilen fälschlich niedrig). Zertifikatsabfrage nutzt **`SUM(completion_count)`** (Migration **`015`** vor Deploy des aktualisierten Produce-Workers ausführen).
|
||||
|
||||
Reference in New Issue
Block a user