Simpl-Resultat/src/services
le king fu 76ddad66c9 feat(balance): per-security drill-down + latent gain in accounts table (#216)
Surface unrealized (latent) gain on the existing balance surfaces, no new
visualization (decision 2026-06-04).

Service:
- AccountLatestSnapshot gains account `kind` + `latest_snapshot_line_id`, so
  the table knows which rows are detailed and where their holdings live.
- getAccountLatentGainByLine(lineId) folds a line's holdings through the
  existing computeUnrealizedGain (shares the book_cost=0 / NULL -> N/A guard).
- rollupLatentGain(accounts): pure aggregation by asset class, by envelope
  (vehicle_type, 'none' bucket), and grand total; per-bucket % denominator is
  the known book_cost only (null when none), mirroring the aggregate guard.

Hook (useBalanceOverview):
- Prefetches per-detailed-account latent gain in parallel (failures isolated),
  exposes latentGainByAccount + latentGainRollup. Simple accounts skipped.

UI:
- BalanceAccountsTable: expandable detailed rows -> per-security value + latent
  gain %; a latent-gain column (shown only when a detailed account has one);
  a summary block aggregating latent gain by asset class / envelope.
- BalanceOverviewCard: total latent gain line (hidden without detailed accounts).
- N/A rendered (never divide-by-zero) when book_cost is NULL or 0; partial-%
  flag when some positions lack a cost basis.

Native non-CAD currency display de-scoped this round (untestable while all
securities are CAD). Modified Dietz return columns (#204) unchanged.

i18n: balance.latentGain.* in FR + EN. Focused unit tests for
getAccountLatentGainByLine and rollupLatentGain (grouping, 'none' envelope,
null-% / unknown book_cost, empty).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 13:49:57 -04:00
..
adjustmentService.ts feat: add Budget and Adjustments pages with full functionality 2026-02-12 00:58:43 +00:00
authService.ts feat: settings banner when OAuth tokens fall back to file store (#81) 2026-04-14 08:18:41 -04:00
balance.service.test.ts feat(balance): per-security drill-down + latent gain in accounts table (#216) 2026-06-06 13:49:57 -04:00
balance.service.ts feat(balance): per-security drill-down + latent gain in accounts table (#216) 2026-06-06 13:49:57 -04:00
budgetService.ts feat: show actual transactions in budget previous year column 2026-03-10 23:03:26 -04:00
categorizationService.test.ts feat: category zoom + secure AddKeywordDialog with context menu (#74) 2026-04-14 15:09:17 -04:00
categorizationService.ts feat: category zoom + secure AddKeywordDialog with context menu (#74) 2026-04-14 15:09:17 -04:00
categoryBackupService.test.ts test(categories): complete test coverage for migration flow (#123) 2026-04-21 19:25:13 -04:00
categoryBackupService.ts feat(categories): add categoryBackupService for pre-migration SREF backup (#120) 2026-04-19 15:46:23 -04:00
categoryMappingService.test.ts test(categories): complete test coverage for migration flow (#123) 2026-04-21 19:25:13 -04:00
categoryMappingService.ts feat(categories): add categoryMappingService (4-pass algo) (#119) 2026-04-20 21:01:55 -04:00
categoryMigrationService.test.ts test(categories): complete test coverage for migration flow (#123) 2026-04-21 19:25:13 -04:00
categoryMigrationService.ts feat(categories): add 3-step migration page + categoryMigrationService (#121) 2026-04-20 21:31:21 -04:00
categoryRestoreService.test.ts feat(categories): add restore backup banner and permanent restore action (#122) 2026-04-20 21:47:43 -04:00
categoryRestoreService.ts feat(categories): add restore backup banner and permanent restore action (#122) 2026-04-20 21:47:43 -04:00
categoryService.ts feat(categories): add v1 IPC seed, i18n keys, and migration v8 (#115) 2026-04-19 16:41:55 -04:00
categoryTaxonomyService.test.ts feat(categories): add categoryTaxonomyService + useCategoryTaxonomy hook (#116) 2026-04-20 20:53:15 -04:00
categoryTaxonomyService.ts feat(categories): add categoryTaxonomyService + useCategoryTaxonomy hook (#116) 2026-04-20 20:53:15 -04:00
dashboardService.ts Bump version to 0.6.0 — Reports enhancements and comment visibility fix 2026-03-04 21:01:13 -05:00
dataExportService.ts feat: make settings data imports visible in Import History 2026-02-15 13:38:51 +00:00
db.ts Fix migration checksum mismatch on startup 2026-03-01 09:17:35 -05:00
feedbackService.test.ts feat: feedback hub widget in Settings Logs card (#67) 2026-04-17 14:36:26 +00:00
feedbackService.ts feat: feedback hub widget in Settings Logs card (#67) 2026-04-17 14:36:26 +00:00
importConfigTemplateService.ts feat: persist template selection and add update template button 2026-02-15 13:16:55 +00:00
importedFileService.ts feat(transactions): inline transfer icon + FK error message 2026-04-25 16:38:46 -04:00
importSourceService.ts fix: persist has_header for imports, fix orphan categories, add re-initialize 2026-02-12 11:54:33 +00:00
licenseService.ts feat: Maximus Account OAuth2 PKCE + machine activation + subscription check (#51, #53) 2026-04-10 14:18:51 -04:00
logService.test.ts feat: feedback hub widget in Settings Logs card (#67) 2026-04-17 14:36:26 +00:00
logService.ts feat: feedback hub widget in Settings Logs card (#67) 2026-04-17 14:36:26 +00:00
profileService.ts fix: address reviewer feedback (#54) 2026-04-09 15:46:27 -04:00
reportService.cartes.test.ts feat(reports/cartes): Mensuel/YTD toggle on KPI cards + user guide section (#102) 2026-04-19 09:49:21 -04:00
reportService.test.ts feat(reports/highlights): default reference month to previous month + YTD current year, user-changeable (#106) 2026-04-19 08:28:30 -04:00
reportService.ts feat(reports/cartes): Mensuel/YTD toggle on KPI cards + user guide section (#102) 2026-04-19 09:49:21 -04:00
transactionService.ts feat(transactions): inline transfer icon + FK error message 2026-04-25 16:38:46 -04:00
userPreferenceService.ts feat(prices): Settings revocation toggle for price_fetching_consent 2026-04-27 08:41:15 -04:00