Kundenansicht P6: alte Abgleiche lassen Abo-Modell-Dokumente dem neuen Abgleich, Zeiten ohne Behalten
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d8c952ac2a
commit
7a03f073bc
5 files changed
+125
-11
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { config } from '../../config.js'
|
||||
import { aboLage, aboMemo } from '../aboStatus.js'
|
||||
import { istAboModell } from '../aboModell.js'
|
||||
import { Query, getDocument, listAllDocuments, updateDocument } from '../appwriteAdmin.js'
|
||||
import { withLocks } from '../keyedLock.js'
|
||||
import { sendCustomerMail } from '../mailer.js'
|
||||
@@ -33,6 +34,10 @@ import { datumKurz } from './zeit.js'
|
||||
* das Dokument `off` und wird nie automatisch aktiv. Nicht automatisch: 'abo_ende_vor_einrichtung' (die Erstattung laeuft,
|
||||
* das Team entscheidet per WOMS), 'team', 'kunde_geloescht' und Altbestand ohne Grund.
|
||||
*
|
||||
* Abo-Modell der Kundenansicht neu (P6): Dokumente mit Marker (istAboModell: unlockedBy UND einrichtungAbrechnung aus abo oder projekt) gehoeren
|
||||
* dem Abgleich der Funktionen des Abo-Modells (aboFunktionenAbgleich.js). Dieser Abgleich und der Sofortpfad ueberspringen sie in jedem Zustand;
|
||||
* sie zaehlen weder in `geprueft` noch in `ausgenommen` und kosten keine Abo-Abfrage.
|
||||
*
|
||||
* Sofortpfad (E9): endeTermineFuerKunde(customerId) beendet die Terminplaner eines Kunden sofort, wenn dessen Wechsel ins Wartungs-
|
||||
* Abo in der Frist widerrufen wird (routes/abo.js, withdrawOrder). Dieselben Aktionen wie Schritt 1 und 1b, aber OHNE Abo-Pruefung
|
||||
* (der Spiegel steht noch auf Wartung, das Team setzt ihn von Hand zurueck); die Meldung (meldeAboEnde) ist dieselbe wie im
|
||||
@@ -274,7 +279,7 @@ export async function endeTermineFuerKunde(customerId, { now = new Date() } = {}
|
||||
if (!customerId) return { beendet }
|
||||
try {
|
||||
const kandidaten = (await listCustomerFeatureDocs(customerId)).filter(
|
||||
(doc) => doc.featureKey === 'termine' && doc.projectId && ['abschalten', 'einrichtung'].includes(aktionFuer(doc))
|
||||
(doc) => doc.featureKey === 'termine' && doc.projectId && !istAboModell(doc) && ['abschalten', 'einrichtung'].includes(aktionFuer(doc))
|
||||
)
|
||||
for (const doc of kandidaten) {
|
||||
try {
|
||||
@@ -407,7 +412,7 @@ export async function gleicheAboAb(now) {
|
||||
return erg
|
||||
}
|
||||
const nachKunde = new Map()
|
||||
for (const doc of dokumente) {
|
||||
for (const doc of dokumente.filter((d) => !istAboModell(d))) {
|
||||
if (!doc.customerId || !doc.projectId) {
|
||||
// ohne Kunde gaelte "kein Abo": nie abschalten, was sich nicht zuordnen laesst
|
||||
erg.fehler += 1
|
||||
|
||||
Reference in new issue
Block a user