reconcile: link a row to its member by slug OR email
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
Both routes are needed. A manual grant often carries no reference at all, so the
row's EMAIL is the only link to its member — and the slug and email local part
routinely differ ('henry-smith' vs 'h.smith@x.org'). The membership test was
slug-first and, when the slug matched neither the reference nor the email, dropped
the row outright: a hand-credited purchase therefore reads as a gap (ntnsndr's
2026-09-28 packs, where the ledger carries +20.00, +5.75 and a -10.75 correction
with no references). _row_belongs_to() accepts either route, in both the
accounted-for test and the nearby-rows context. 38 checks; all 18 suites green.
This commit is contained in:
1 parent
711371f9d7
commit
c174fa2ffe
2 files changed
+35
-8
No files matched your search
@@ -213,6 +213,19 @@ async def main():
|
||||
m.credit_pack_accounted(next(x for x in ORDERS if x["id"] == "or_CCC"),
|
||||
ledger_rows(), []) is None)
|
||||
|
||||
# A manual grant with NO reference links to its member by EMAIL, and the slug
|
||||
# and email local part routinely differ ("henry-smith" vs "h.smith@x.org").
|
||||
# Matching only on the slug in the reference drops that row — which is how a
|
||||
# hand-credited purchase comes to look like a gap.
|
||||
henry = order("or_HH2", "henry-smith", 12, 1.0)
|
||||
henry_rows = [{"email": "h.smith@x.org", "delta": 12.0, "reference": None,
|
||||
"created_at": stamp(1.0), "reason": "manual application"}]
|
||||
check("a reference-less manual grant is matched via the MEMBER EMAIL",
|
||||
m.credit_pack_accounted(henry, henry_rows, [],
|
||||
member_email="h.smith@x.org") is not None)
|
||||
check("...and is NOT matched without it (the slug alone finds nothing)",
|
||||
m.credit_pack_accounted(henry, henry_rows, []) is None)
|
||||
|
||||
# ---------- a read that fails is UNKNOWN, never 'nothing missing' ---------
|
||||
FAIL_ORDERS = True
|
||||
res = await m.reconcile_credit_packs(apply=False)
|
||||
|
||||
Reference in new issue
Block a user