[#214] Fix date range filter for flow-imported data in list API and z…#215
Merged
Conversation
…ip download - Fix `latest_child_activity` annotation to use `Coalesce(updated, created)` so flow-imported children with `updated=NULL` contribute their `created` date instead of NULL, preventing registrations with recent monitoring from being excluded by the date filter - Fix `latest_child_form_subquery` ordering to use `Coalesce(updated, created)` so NULL-updated records are ranked by `created` rather than sorted first - When `sort_by=latest_activity`, apply date filter to the annotated `latest_activity` field so registrations with recent monitoring children are included even when the registration itself predates `date_from` - Add `filter_child_form_ids` param to `download_data` and `generate_data_sheet` to separate "which children determine parent inclusion" from "which children are merged into rows" - In `_generate_zip_download`, pass `filter_child_form_ids=child_form_ids` when generating the registration sheet so the union approach (parent in range OR child in range) applies even though monitoring columns are not merged into the registration sheet - Add tests: `test_null_updated_child_uses_created_for_latest_activity`, `test_date_filter_uses_latest_activity_when_sorting_by_it`, `test_date_filter_uses_created_when_not_sorting_by_latest_activity`, `test_zip_registration_included_when_monitoring_in_date_range` [#214] Update date_from/date_to OpenAPI descriptions for latest_activity behaviour Descriptions previously said "Filter data created on or after this date" which is no longer accurate when sort_by=latest_activity filters on the annotated latest_activity field instead of created. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
ab40d22 to
4a9c598
Compare
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.
latest_child_activityannotation to useCoalesce(updated, created)so flow-imported children withupdated=NULLcontribute theircreateddate instead of NULL, preventing registrations with recent monitoring from being excluded by the date filterlatest_child_form_subqueryordering to useCoalesce(updated, created)so NULL-updated records are ranked bycreatedrather than sorted firstsort_by=latest_activity, apply date filter to the annotatedlatest_activityfield so registrations with recent monitoring children are included even when the registration itself predatesdate_fromfilter_child_form_idsparam todownload_dataandgenerate_data_sheetto separate "which children determine parent inclusion" from "which children are merged into rows"_generate_zip_download, passfilter_child_form_ids=child_form_idswhen generating the registration sheet so the union approach (parent in range OR child in range) applies even though monitoring columns are not merged into the registration sheettest_null_updated_child_uses_created_for_latest_activity,test_date_filter_uses_latest_activity_when_sorting_by_it,test_date_filter_uses_created_when_not_sorting_by_latest_activity,test_zip_registration_included_when_monitoring_in_date_range🤖 Generated with Claude Code