Skip to content

feat(formulus): Filter out soft-deleted observations in WatermelonDBRepo and related hooks/services#520

Merged
Mishael-2584 merged 5 commits intodevfrom
fix-soft-delete
Mar 17, 2026
Merged

feat(formulus): Filter out soft-deleted observations in WatermelonDBRepo and related hooks/services#520
Mishael-2584 merged 5 commits intodevfrom
fix-soft-delete

Conversation

@Mishael-2584
Copy link
Contributor

Description

Observations are soft-deleted (a deleted flag is set); the record stays in the database. List APIs and the UI were not filtering by this flag, so deleted observations still appeared on the Observations screen and in formplayer/choice lists.

Changes:

  • WatermelonDBRepo: getObservationsByFormType() now includes Q.where('deleted', false) so only non-deleted observations are returned. Removed the temporary debug log that printed total observation count.
  • FormService: In getObservationsByQuery(), when includeDeleted is not set, results are filtered to exclude observations with deleted === true, so choice lists and formplayer only see active observations by default.
  • useObservations: The observations list now excludes any observation with obs.deleted === true so the Observations screen never shows soft-deleted items.

Delete behavior is unchanged: the record is only updated with deleted = true; it is not removed from the database. List and detail screens now consistently hide deleted observations.

Type of Change

  • Bug Fix
  • New Feature / Enhancement
  • Refactor / Code Cleanup
  • Documentation Update
  • Maintenance / Chore
  • Other (please specify):

Component(s) Affected

  • formulus (React Native mobile app)
  • formulus-formplayer (React web app)
  • synkronus (Go backend server)
  • synkronus-cli (Command-line utility)
  • Documentation
  • DevOps / CI/CD
  • Other:

Related Issue(s)

Closes/Fixes/Resolves: Closes #495


Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manually tested
  • Tested on multiple platforms (if applicable)
  • Not applicable

Breaking Changes

  • This PR introduces breaking changes
  • This PR does NOT introduce breaking changes

If breaking changes, please describe migration steps: N/A


Documentation Updates

  • Documentation has been updated
  • Documentation update is not required

Checklist

  • Code follows project style guidelines
  • All existing tests pass
  • New tests added for new functionality
  • PR title follows Conventional Commits format

Thank you for contributing to Open Data Ensemble (ODE)!

Copy link
Contributor

@najuna-brian najuna-brian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mishael-2584 Mishael-2584 merged commit 52fe206 into dev Mar 17, 2026
10 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.

[Formulus] Hide observations from observation screen when deleted==true

2 participants