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:
@@ -40,7 +40,7 @@ Rang aus **`political_office_type.name`** (Substring-Heuristik im Daemon, ohne D
|
||||
|
||||
## Abgeschlossene Produktionen
|
||||
|
||||
**`COUNT(*)`** aus `falukant_log.production` mit `producer_id = falukant_user.id` **oder** `character.id`, und **Zeitstempel** `>= certificate_productions_count_since` (Spalte auf `falukant_user`, Migration **`014_falukant_certificate_productions_count_since.sql`**). **`NULL`** bei dieser Spalte: alle passenden Log-Zeilen (Bestand bis zur ersten Stufenänderung nach Migration).
|
||||
**`SUM(completion_count)`** aus `falukant_log.production` mit `producer_id = falukant_user.id` **oder** `character.id`, und **Zeitstempel** `>= certificate_productions_count_since` (Spalte auf `falukant_user`, Migration **`014`**). **`completion_count`** (Migration **`015`**): pro abgeschlossener Produktion +1; das Log **aggregiert** noch immer pro Tag/Produkt/Region (`quantity` per UPSERT), daher reicht **`COUNT(*)`** der Zeilen nicht — ohne Summe bliebe der Zähler bei vielen Abschlüssen gleich. **`NULL`** bei `certificate_productions_count_since`: alle passenden Log-Zeilen (Bestand bis zur ersten Stufenänderung nach Migration).
|
||||
|
||||
Bei jedem **Aufstieg**, **Bankrott** (Stufe 1) und **Erbfolge ohne Erben** setzt der Daemon **`certificate_productions_count_since = NOW()`** — die Mindestanforderungen für die **nächste** Stufe gelten damit nur für **neu** abgeschlossene Produktionen. **Logs werden dafür nicht gelöscht** (bleiben u. a. für Wissens-Updates / Preise); optional räumt `QUERY_DELETE_OLD_PRODUCTIONS` nur sehr alte Zeilen auf (aktuell **30 Tage** Retention, Speicherbegrenzung).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user