• Mahmoud Aglan's avatar
    fix(settlements): find the name, count the money, and stop crying wolf · fe003fd4
    Mahmoud Aglan authored
    Three things the screen got wrong on the first day it was used.
    
    Search could not find people. `like '%term%'` over name_ar fails on this
    data for two reasons that have nothing to do with the searcher being
    careless: nobody agrees about hamza (عبدالله أحمد / عبدالله احمد is the
    same child, so is يحيى/يحيي and حمزة/حمزه), and a name on file is four or
    five words while the person searching types the two they remember —
    "عبدالله صلاح" against "عبدالله أحمد صلاح سيد" matches nothing because
    those words are not adjacent. ArabicSearch folds both sides to one
    spelling and requires each word of the term to appear somewhere in the
    name, folding in SQL (Postgres translate) so the database does the work.
    
    The bundle probe asked whether a product line existed, so a boy who paid
    2,500 toward his federation card — typed as "القسط الاول" on the same
    invoice as his kit — was reported as never having bought one. That is the
    exact reading the group roster stopped doing last week, and two screens
    answering the same question differently is worse than either answer. It
    now reads the money the way BundledProductLine does, bare instalments
    included where the programme requires exactly one product, and reports a
    position rather than a yes/no: paid, part paid with the remainder and a
    progress bar, or nothing at all.
    
    And the worklist was flagging ordinary business. A renewal issued on the
    1st and due on the 8th is not an anomaly, it is Tuesday — so the flags now
    fire on invoices past their due date, not merely unpaid. A card being paid
    off on an agreed plan through the till is not an anomaly either; only
    money recorded outside the product is. "Requires a card and has not bought
    one" is a sales fact, not a payment anomaly, so it annotates an account
    without summoning it. And enrolment start_date is copied from the GROUP's
    season start, so a player entered in August carried a 16 July start and
    was reported as owing months of a season he was not in — the month he
    joined is the later of start_date and enrollment_date.
    
    On the restored tenant this takes the worklist from 165 accounts to 77,
    and unbilled-month flags from 35 to 1. Participant 219 now reads
    "سدد 2,500 من 8,000" instead of "لم يُحاسَب على مستلزم البرنامج".
    
    Verified: 46 settlement/search/render cases pass, full suite 318 tests on
    both SQLite and the restored tenant, no failures.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    fe003fd4
ArabicSearchTest.php 2.48 KB