feat: unify income payment cards and drop period comparisons (WealthLedger/main#33) (#83)
feat: unify income payment cards and drop period comparisons (WealthLedger/main#33)
This commit was merged in pull request #83.
This commit is contained in:
@@ -111,13 +111,6 @@ export function planInvestmentScreen(
|
||||
priority: 'screen' as const,
|
||||
})),
|
||||
);
|
||||
const knownOpening =
|
||||
accounts.length && accounts.every((account) => account.openedOn)
|
||||
? new Date(
|
||||
// eslint-disable-next-line sonarjs/no-alphabetical-sort -- Code-unit ordering is intentional for canonical keys and ISO dates; locale collation would change persisted bindings.
|
||||
`${accounts.map((account) => account.openedOn ?? '').sort()[0]}T00:00:00+03:00`,
|
||||
)
|
||||
: undefined;
|
||||
if (!context.membershipKnown) return { sources, unavailable, now };
|
||||
if (
|
||||
['account', 'accounts', 'bond', 'events', 'stock'].includes(screen.screen)
|
||||
@@ -142,23 +135,9 @@ export function planInvestmentScreen(
|
||||
const period = planIncomePeriod(
|
||||
screen.screen === 'income' ? screen.from : undefined,
|
||||
screen.screen === 'income' ? screen.to : undefined,
|
||||
knownOpening,
|
||||
);
|
||||
for (const range of [
|
||||
period.selected,
|
||||
...(screen.screen === 'income'
|
||||
? [period.previous, ...(period.yearAgo ? [period.yearAgo] : [])]
|
||||
: []),
|
||||
]) {
|
||||
const bounds = dateOnlyBounds(range, now);
|
||||
operations(bounds.from, bounds.to);
|
||||
}
|
||||
if (screen.screen === 'income' && !period.yearAgo) {
|
||||
unavailable.push({
|
||||
resourceKey: 'income/yearAgo', // gitleaks:allow public resource identifier
|
||||
reason: 'calendar_or_account_boundary',
|
||||
});
|
||||
}
|
||||
const bounds = dateOnlyBounds(period.selected, now);
|
||||
operations(bounds.from, bounds.to);
|
||||
if (screen.screen === 'account') {
|
||||
const range = ledgerRange(
|
||||
screen.from,
|
||||
|
||||
Reference in New Issue
Block a user