statistiques

Documents Toollab statistics endpoints, calculation invariants, and front-end pages for financial reporting.

Updated May 5, 2025
One-click install
npx skills add https://github.com/sebauvray/toollab-api --skill statistiques-sebauvray
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: statistiques
Source: https://github.com/sebauvray/toollab-api/tree/main/.claude/skills/statistiques
Command: npx skills add https://github.com/sebauvray/toollab-api --skill statistiques-sebauvray

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Modifying Toollab's statistics module without breaking financial invariants is risky: encaissé vs exonéré amounts, enrollment counters, and family payment statuses must satisfy strict sum rules, and several endpoints share query helpers with their Excel exports. This Skill captures those invariants, known pitfalls, and page structures so changes stay consistent. ## Core Features & Use Cases - Endpoint reference: Documents the 9 StatisticsController endpoints (overview, unpaid families, payments, exports, trends), which ones are actually consumed by the front, and their filter parameters. - Calculation invariants: Defines the rules that must never break (encaissé ≠ exonéré, men+women+children == total, paid+partially+fully == total, no hardcoded amounts). - Known issues and fixes: Lists unvalidated parameters causing 500 errors (page, per_page), in-memory pagination performance constraints, and legacy JSON fallbacks to preserve. - Use Case: When asked to add a new indicator to the /statistiques dashboard or fix an export, consult this Skill to respect the shared query helpers and avoid reintroducing hardcoded tariff amounts. ## Quick Start Use the statistiques skill to add a new payment-type filter to the payments endpoint and its Excel export while keeping the calculation invariants intact.

Frequently Asked Questions about statistiques

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a filter to the statistics payments endpoint?▼

Add the filter parameter to the shared buildPaymentsQuery helper so both the paginated list and the Excel export stay consistent. Filters must be applied server-side; never filter paginated server data on the client.

What is the difference between encaissé and exonéré in payment statistics?▼

Encaissé counts only cheque, cash, and card lines as real treasury, while exonéré counts exemption lines as discounts, not payments. Collection rate uses encaissé divided by expected; recovery rate adds exonéré to the numerator.

Why does the statistics endpoint return a 500 error with an empty page parameter?▼

The page parameter is not cast to int in unpaidFamilies and payments, so a non-numeric string triggers a TypeError in PHP 8. A per_page of 0 causes a DivisionByZeroError; adding request validation fixes both cases.

Why are unpaid families paginated in memory instead of in SQL?▼

computeFamilyFinancials calculates the expected amount for every family with active enrollments before pagination, so the server processes the full dataset on each page. The documented fix is materializing expected amounts rather than recalculating.

Which statistics endpoints are actually used by the front-end pages?▼

Six endpoints are consumed: overview, unpaid-families, payments, available-banks, and the two exports. enrollment-trends, revenue-by-month, and search-payments exist in the service layer but no page calls them.