Skip to content

feat(Summaries): enhance transformQuery handling for database and colection sources, and add tests for summary scope - #9

Merged
luanfreitasdev merged 1 commit into
mainfrom
improvements
Oct 27, 2026
Merged

luanfreitasdev merged 1 commit into
mainfrom
improvements

Conversation

@luanfreitasdev

Copy link
Copy Markdown
Member

This pull request improves how summary calculations (like totals or averages) are handled in data processing pipelines, ensuring that query transformations are respected and that caching works correctly across different query scopes. The changes impact both database and collection data sources and add comprehensive tests to verify correct behavior.

Pipeline and Query Processing Updates:

  • Ensured that the Summaries pipeline is now run after any query transformations, so summary values (like totals) always reflect filtered or scoped data, not just the raw datasource. (src/DataSource/Processors/CollectionProcessor.php [1] src/DataSource/Processors/ModelProcessor.php [2] [3]

Caching Improvements:

  • Updated the cache tag generation in ArrayGridContext to include the transformed query or collection, preventing cache collisions between different query scopes (e.g., different filters). Now, summaries are always cached per unique query, whether the source is a database query or a collection. (src/Support/State/ArrayGridContext.php src/Support/State/ArrayGridContext.phpL141-R151)

Test Coverage:

  • Added tests to verify that summaries respect the transformQuery scope for both database and collection sources, and that cache tags are unique per scope, preventing incorrect summary reuse. (tests/Feature/SummariesTest.php tests/Feature/SummariesTest.phpR61-R105)

Dependency Imports:

…lection sources, and add tests for summary scope
@luanfreitasdev
luanfreitasdev merged commit e0cd895 into main Oct 27, 2026
6 checks passed
@luanfreitasdev
luanfreitasdev deleted the improvements branch October 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant