Repository navigation
fix(wake): faturamento defaults its comparison; document dashboard buckets and order sort - #604
Merged
Merged
Conversation
…ckets and order sort Tested against a live store after #600: - /dashboard/faturamento answers 422 without a comparison period, so WAKE_DASHBOARD now compares with the same number of days just before unless dataInicialComparativo/dataFinalComparativo are given. - Only `captados` is by order date (it matched WAKE_LIST_ORDERS for a day, count and revenue). `cancelados` matched the orders moved to a canceled status that day, so pagos/enviados/cancelados are event-dated. - carrinhoAbandonado leaves dataFinal out (same day → 0). - /pedidos sorts by the order date whatever enumTipoFiltroData. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
yuriassuncx
approved these changes
Nov 26, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.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.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.faturamentowithout comparison dates on the same connection.🤖 Generated with Claude Code
Summary by cubic
Fixes the Wake
WAKE_DASHBOARDfaturamentotool 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.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.Written for commit d71bcd3. Summary will update on new commits.