Repository navigation
fix(loyalty): correct points scale and add billing history to ledger - #562
Merged
Merged
Conversation
Cashback points were multiplied by a leftover 100x redemption-rate constant on top of the percent calculation, so an 80% cashback rate on a ₹50 item earned 4000 points instead of 40. Points are now 1:1 with currency; wallet redemption and debit recording were updated to match so earning and redeeming stay consistent. The customer ledger modal now also shows billing history per bill (amount, points earned, points redeemed) plus totals for spend, points earned, and points redeemed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
… window The busiest-hour/busiest-day fixtures were pinned to a fixed calendar week (2026-06-01..07). Once "now" moved more than 90 days past that week, GET /api/reports/insights?days=90 silently excluded them from its trailing window, leaving only the unrelated "recent" rolling-window fixtures to determine busiest hour/day and breaking the assertions. Fixtures are now computed relative to "now" from a single shared Monday anchor 3 weeks back, spaced apart from the "recent" fixtures so the two sets can never land on the same calendar day, and can no longer drift out of the query window. Co-Authored-By: Claude Sonnet 5 <[email protected]>
carvalab
added a commit
that referenced
this pull request
Aug 31, 2026
…ion (#513) - theme_mode setting (light|dark|system, default system) validated in both write paths (IPC set-setting + HTTP wildcard PUT); no migration, no seeding - useThemeMode store + ThemeSync component: matchMedia resolution, .dark toggle, ownership-gated localStorage mirror, token-gated DB seed for follower windows (DB > param > mirror > OS, bounded retry with real delay + one-shot 60s re-check after transient failure), in-window user-choice guard, server-truth rollback with needsServerTruth hydration delivery, post-login re-hydration via flo:auth-changed, set-theme-effective push - FOUC pre-paint guard (param > mirror > prefers-color-scheme) with vm-based precedence matrix test - main-process wiring: direct getDatabase() initial isDark at window creation, sender-validated set-theme-effective handler (overlay + background color, main window only), effectiveTheme on get-status, ?theme= on the KDS window URL - Appearance settings tab (ownerManager-gated, optimistic + rollback, 5 locales incl. French from #549) - native Electron e2e: dark toggle, nativeTheme.themeSource system sync, relaunch persistence; theme-mode-settings + theme-fouc-script suites; KDS-hardening and renderer-API expectations aligned - full dark-mode coverage: Settings page and panels, products, customers, tables, staff, addon-groups, POS modals, KDS components, dashboard, loyalty ledger modal — light mode pixel-stable - docs amended (title-bar-phase1, platform matrix); reports-insights fixtures date-independent; allowScripts field for local install scripts Review fixes (greptile): in-window user-choice guard; DB fetch before mirror; bounded retry with no stale mirror write-back; server-truth rollback; one-shot follower re-check after transient outage; hydration delivers server truth when a failed save armed it. Ponytail cleanup: shared fetchThemeMode helper (boot + recheck dedup), stdlib asserts in theme-mode-settings, trimmed VM stubs, optional relaunch on relaunched harness, dead refs/conditions/comments removed (-144 lines). Rebase follow-ups (#537/#549/#546/#562): tokenize weighted-products/refund/ period-toggle/loyalty-ledger surfaces; fr.json theme-key parity; auth dispatch guarded for non-browser envs (auth-ui-deterministic); themed order-card selector in quick-customer-creation e2e; dashboard KPI values kept dark on pastel tiles; test:refunds restored to the test chain; comment hygiene (~200 lines of review-narration stripped); allowScripts field for local npm install scripts.
carvalab
added a commit
that referenced
this pull request
Aug 31, 2026
…ion (#513) - theme_mode setting (light|dark|system, default system) validated in both write paths (IPC set-setting + HTTP wildcard PUT); no migration, no seeding - useThemeMode store + ThemeSync component: matchMedia resolution, .dark toggle, ownership-gated localStorage mirror, token-gated DB seed for follower windows (DB > param > mirror > OS, bounded retry with real delay + one-shot 60s re-check after transient failure), in-window user-choice guard, server-truth rollback with needsServerTruth hydration delivery, post-login re-hydration via flo:auth-changed, set-theme-effective push - FOUC pre-paint guard (param > mirror > prefers-color-scheme) with vm-based precedence matrix test - main-process wiring: direct getDatabase() initial isDark at window creation, sender-validated set-theme-effective handler (overlay + background color, main window only), effectiveTheme on get-status, ?theme= on the KDS window URL - Appearance settings tab (ownerManager-gated, optimistic + rollback, 5 locales incl. French from #549) - native Electron e2e: dark toggle, nativeTheme.themeSource system sync, relaunch persistence; theme-mode-settings + theme-fouc-script suites; KDS-hardening and renderer-API expectations aligned - full dark-mode coverage: Settings page and panels, products, customers, tables, staff, addon-groups, POS modals, KDS components, dashboard, loyalty ledger modal — light mode pixel-stable - docs amended (title-bar-phase1, platform matrix); allowScripts field for local npm install scripts Review fixes (greptile): in-window user-choice guard; DB fetch before mirror; bounded retry with no stale mirror write-back; server-truth rollback; one-shot follower re-check after transient outage; hydration delivers server truth when a failed save armed it. Ponytail cleanup: shared fetchThemeMode helper (boot + recheck dedup), stdlib asserts in theme-mode-settings, trimmed VM stubs, optional relaunch on relaunched harness, dead refs/conditions/comments removed (-144 lines). Rebase follow-ups (#537/#549/#546/#562): tokenize weighted-products/refund/ period-toggle/loyalty-ledger surfaces; fr.json theme-key parity; auth dispatch guarded for non-browser envs (auth-ui-deterministic); themed order-card selector in quick-customer-creation e2e; dashboard KPI values kept dark on pastel tiles; reports-insights fixtures date-independent (upstream #562 fix adopted); test:refunds restored to the test chain; comment hygiene (~200 lines of review-narration stripped); allowScripts field for local npm install scripts.
carvalab
added a commit
that referenced
this pull request
Aug 31, 2026
…ion (#513) (#563) - theme_mode setting (light|dark|system, default system) validated in both write paths (IPC set-setting + HTTP wildcard PUT); no migration, no seeding - useThemeMode store + ThemeSync component: matchMedia resolution, .dark toggle, ownership-gated localStorage mirror, token-gated DB seed for follower windows (DB > param > mirror > OS, bounded retry with real delay + one-shot 60s re-check after transient failure), in-window user-choice guard, server-truth rollback with needsServerTruth hydration delivery, post-login re-hydration via flo:auth-changed, set-theme-effective push - FOUC pre-paint guard (param > mirror > prefers-color-scheme) with vm-based precedence matrix test - main-process wiring: direct getDatabase() initial isDark at window creation, sender-validated set-theme-effective handler (overlay + background color, main window only), effectiveTheme on get-status, ?theme= on the KDS window URL - Appearance settings tab (ownerManager-gated, optimistic + rollback, 5 locales incl. French from #549) - native Electron e2e: dark toggle, nativeTheme.themeSource system sync, relaunch persistence; theme-mode-settings + theme-fouc-script suites; KDS-hardening and renderer-API expectations aligned - full dark-mode coverage: Settings page and panels, products, customers, tables, staff, addon-groups, POS modals, KDS components, dashboard, loyalty ledger modal — light mode pixel-stable - docs amended (title-bar-phase1, platform matrix); allowScripts field for local npm install scripts Review fixes (greptile): in-window user-choice guard; DB fetch before mirror; bounded retry with no stale mirror write-back; server-truth rollback; one-shot follower re-check after transient outage; hydration delivers server truth when a failed save armed it. Ponytail cleanup: shared fetchThemeMode helper (boot + recheck dedup), stdlib asserts in theme-mode-settings, trimmed VM stubs, optional relaunch on relaunched harness, dead refs/conditions/comments removed (-144 lines). Rebase follow-ups (#537/#549/#546/#562): tokenize weighted-products/refund/ period-toggle/loyalty-ledger surfaces; fr.json theme-key parity; auth dispatch guarded for non-browser envs (auth-ui-deterministic); themed order-card selector in quick-customer-creation e2e; dashboard KPI values kept dark on pastel tiles; reports-insights fixtures date-independent (upstream #562 fix adopted); test:refunds restored to the test chain; comment hygiene (~200 lines of review-narration stripped); allowScripts field for local npm install scripts.
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.
Summary
floor(amount × rate / 100)in currency, then multiplied by a leftoverLOYALTY_REDEMPTION_RATE = 100constant meant for a paise-based scale that's no longer used. An 80% cashback rate on a ₹50 item earned 4000 points instead of 40.preparePaymentBatch) and debit recording were updated in the same change so spending points stays consistent with the new earn rate — leaving only the earn side fixed would have made redemption ~100x too stingy.Test plan
npm run lint— clean (pre-existing warnings only)npm run build— backend compiles cleannpm run i18n:check— all 5 locales passtests/integration-loyalty.test.ts— 11/11 passedtests/integration-loyalty-redemption.test.ts— 40/40 passedtests/integration-loyalty-global-rate.test.ts— 24/24 passedtests/integration-payments.test.ts— 33/33 passedtests/issue-214-payment-integrity.test.ts— 83/83 passedtests/payment-modal-currency-adapter.test.ts— passednpm test— no new failures; the only failures (reports-insights.test.ts, busiest hour/day) are pre-existing onmain, confirmed viagit stash🤖 Generated with Claude Code