fixes #9

Merged
mustafa.ahmed merged 3 commits from fixes into main 2026-04-20 12:10:42 +00:00

Added a new config flag SyncServiceEnabled and updated startup flow to run the background auto-sync timer only when this flag is true.

Implemented session-safe duplicate meal protection in scan flow using production hrms.lunch_order checks by employee_serial_number, order_date (today), meal_name, and location_site_id, returning "Meal already taken" when the same meal is already consumed.

Updated sync behavior for reliability: immediate sync attempt after local save when production is reachable, and duplicate-aware manual sync that marks local unsynced records as synced when the meal already exists in production.

Why

Prevent same-meal double consumption while still allowing different meals in the same day.

Support controlled operations where auto-sync can be disabled (syncService = false) for offline/manual scenarios.

Avoid endless retries for already-posted rows by treating production duplicates as successful sync outcomes.

Added a new config flag SyncServiceEnabled and updated startup flow to run the background auto-sync timer only when this flag is true. Implemented session-safe duplicate meal protection in scan flow using production hrms.lunch_order checks by employee_serial_number, order_date (today), meal_name, and location_site_id, returning "Meal already taken" when the same meal is already consumed. Updated sync behavior for reliability: immediate sync attempt after local save when production is reachable, and duplicate-aware manual sync that marks local unsynced records as synced when the meal already exists in production. **Why** Prevent same-meal double consumption while still allowing different meals in the same day. Support controlled operations where auto-sync can be disabled (syncService = false) for offline/manual scenarios. Avoid endless retries for already-posted rows by treating production duplicates as successful sync outcomes.
mustafa.ahmed added 2 commits 2026-04-20 12:10:28 +00:00
a22562cb59 Implement session-based duplicate meal guard with optional auto-sync control
Added a configurable SyncServiceEnabled flag in app config and wired startup to run the background sync timer only when enabled. Updated scan processing to enforce production duplicate checks by employee_serial_number + order_date + meal_name + location_site_id, blocking same-session repeat scans with “Meal already taken” while still allowing different meals on the same day. Improved offline/online behavior by saving locally first and attempting immediate sync when production is reachable, and enhanced manual sync to treat production duplicates as success by marking local IsSynced=1 instead of retrying forever.
mustafa.ahmed added 1 commit 2026-04-20 12:10:36 +00:00
mustafa.ahmed merged commit bda42b2a84 into main 2026-04-20 12:10:42 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mustafa.ahmed/Utopia-Canteen-System#9
There is no content yet.