Skip to content

[#214] Fix date range filter for flow-imported data in list API and z…#215

Merged
ifirmawan merged 1 commit into
mainfrom
feature/214-issues-with-data-migrated
May 18, 2026
Merged

[#214] Fix date range filter for flow-imported data in list API and z…#215
ifirmawan merged 1 commit into
mainfrom
feature/214-issues-with-data-migrated

Conversation

@ifirmawan
Copy link
Copy Markdown
Collaborator

@ifirmawan ifirmawan commented May 18, 2026

  • 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

🤖 Generated with Claude Code


@ifirmawan ifirmawan self-assigned this May 18, 2026
@ifirmawan ifirmawan linked an issue May 18, 2026 that may be closed by this pull request
@ifirmawan ifirmawan marked this pull request as ready for review May 18, 2026 11:34
…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>
@ifirmawan ifirmawan force-pushed the feature/214-issues-with-data-migrated branch from ab40d22 to 4a9c598 Compare May 18, 2026 12:22
@ifirmawan ifirmawan merged commit 5cd60da into main May 18, 2026
4 checks passed
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.

Issues with Data Migrated

1 participant