Conversation
Filtering the Sales report by Created Date or Close Date has to happen over the whole received snapshot, because the endpoint paginates server-side and a client only ever holds one page. Adds dateColumn plus inclusive dateFrom/dateTo bounds, applied alongside the existing search and column filters. Comparison uses each cell's underlying Salesforce value rather than its localized label, so a datetime resolves to the day the report displays; rows without a usable date are excluded rather than counted. Bounds are validated as real calendar days, so 2026-02-30 and non-leap 2027-02-29 are rejected. Adds a summary block covering every matching row so metrics stay correct under pagination: record count, per-column amount totals with currency agreement, and category breakdowns such as pipeline stage. Totals round to cents to keep floating-point artifacts out of displayed currency. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Server-side half of PM-6364. Pairs with platform-ui#2319, which adds the Sales Portal controls.
Both
GET /v6/reports/salesandGET /v6/reports/win/salesget the new parameters and response field; authorization is unchanged.Why this is server-side
The endpoint paginates over the Salesforce snapshot, so a client only ever holds one page of rows. Filtering by date in the browser would make the record count and every total describe the visible page rather than the result. The range and the aggregates are applied over the whole received snapshot before pagination, exactly like the existing search and column filters.
Date range
dateColumndate/datetimecolumn, such as Created Date or Close DatedateFrom,dateToYYYY-MM-DDbounds; either or both, and both requiredateColumnComparison uses each cell's underlying Salesforce value, never its localized label: a datetime keeps the report's own offset, so its day matches the day the report displays. A row whose date cell is null or unparseable cannot satisfy a range and is excluded rather than counted.
dateColumnalone is a no-op, which lets a client keep the field selected while the range is empty.400covers a bound withoutdateColumn,dateFromafterdateTo, adateColumnthat is not a date column, and any bound that is not a real calendar day —2026-02-30and non-leap2027-02-29are rejected, and datetimes are not accepted as bounds.summaryDescribes every matching row, not the returned page:
recordCount— always equal tototalamounts[]— percurrency/doublecolumn:total, contributingcount,mixedCurrency, andcurrencyCodewhen contributing rows agreegroups[]— up to three category columns broken into buckets of{label, count, total}, ordered by total then count, capped at 25 with the remainder inotherBucketsmixedCurrencyseparates a genuine cross-currency sum, which clients must not present as one currency, from a single-currency org where Salesforce returns bare numbers. Totals round to cents so repeated floating-point addition cannot leak artifacts such as0.30000000000000004into displayed currency.Aggregates cover received rows only, so
allData: falselimits them exactly as it limitstotal.Compatibility
Additive. Existing callers, including WIN, see identical
rows,totaland pagination;summaryis a new field and the date parameters are optional.Verification
npx jest src/reports/sales— 38 passed, including new coverage for inclusive and open-ended ranges, underlying-value comparison with a datetime offset, rows excluded for want of a date, combination with search and column filters, every400case, and aggregates under pagination and mixed currenciesnpx eslint src/reports/sales/**/*.tsandnpx tsc --noEmit— clean🤖 Generated with Claude Code