fix(wake): faturamento defaults its comparison; document dashboard buckets and order sort
Merged
TH
4d ago+55+55+01234567890123456789-9-9-0123456789
Why
I tested #600 against a live store right after its deploy (1.1.0). Every new tool answered, but three things needed a fix or a word in the docs:
WAKE_DASHBOARDfaturamentofailed with HTTP 422 whenever the caller gave no comparison period: Wake requiresdataInicialComparativoanddataFinalComparativo.- The dashboard buckets don't all mean the same thing, and nothing said so:
captadosis by order date. For one day it matchedWAKE_LIST_ORDERSexactly, in count and in revenue, also when summed across the 24 hourly buckets.canceladosmatched the orders that moved to a canceled status that day (enumTipoFiltroData=DataModificacaoStatus, statuses 3ā8), whenever they were placed. Sopagos,enviadosandcanceladosare event-dated.carrinhoAbandonadoleaves outdataFinal: a range that starts and ends on the same day returns 0.
/pedidossorts by the order date (data) whateverenumTipoFiltroDatasays. The tool description implied it sorted by the filter date.
What
faturamentonow compares with the same number of days just before (previousPeriod) when no comparison dates are given. Explicit dates still win.WAKE_DASHBOARD's description, the field descriptions and the README say which buckets are by order date and which are event-dated, and note thecarrinhoAbandonadoend-date behaviour.WAKE_LIST_ORDERSdescribes the sort order correctly.- Version bumped to 1.1.1.
Verified
bun test(wake): 24 pass. That includespreviousPeriod, for a single day and for a range that crosses a month.scripts/check.ts wake,oxfmt --check,oxlint(the only wake warning predates this) andcheck:registryare clean.- The bucket behaviour above was measured live on 1.1.0. After deploy I'll call
faturamentowithout comparison dates on the same connection.
š¤ Generated with Claude Code
Summary by cubic
Fixes the Wake WAKE_DASHBOARD faturamento tool failing with HTTP 422 when no comparison period is given, and documents the actual semantics of dashboard buckets and list ordering.
faturamentonow defaults to the period of equal length immediately before; explicit comparison dates still win.- Documents that only
captadoscounts by order date;pagos,enviados, andcanceladoscount orders that reached that state in the bucket, and thatcarrinhoAbandonadoignoresdataFinal. WAKE_LIST_ORDERSnow states that rows always sort by the order date, regardless of the date filter.