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:
@@ -451,7 +451,11 @@ export class BrokerageOperationsService {
|
||||
key: `${period.from}/${period.to}`,
|
||||
movingEnd: false,
|
||||
}));
|
||||
return periods.map((period, index) => {
|
||||
const rows = saved?.rows ?? [];
|
||||
const instruments = await this.metadata.savedMany(
|
||||
rows.map((row) => row.payload as TbankOperationItem),
|
||||
);
|
||||
return periods.map((period) => {
|
||||
const targets = (saved?.connection.accounts ?? []).map((account) => ({
|
||||
accountId: account.accountId,
|
||||
...period,
|
||||
@@ -487,8 +491,7 @@ export class BrokerageOperationsService {
|
||||
null;
|
||||
const confirmed = confirmedOperationRanges(plan.intervals, sources);
|
||||
const meta = investmentResourceMeta({
|
||||
// eslint-disable-next-line security/detect-object-injection -- The numeric index enumerates the three comparison periods.
|
||||
resourceKey: `income/${accountId}/${['selected', 'previous', 'yearAgo'][index]}/${period.key}`,
|
||||
resourceKey: `income/${accountId}/selected/${period.key}`,
|
||||
dataRevision: saved?.binding ?? 'missing',
|
||||
availability: !known
|
||||
? 'missing'
|
||||
@@ -542,7 +545,7 @@ export class BrokerageOperationsService {
|
||||
return {
|
||||
meta,
|
||||
items: complete
|
||||
? (saved?.rows ?? [])
|
||||
? rows
|
||||
.filter((row) =>
|
||||
plan.intervals.some(
|
||||
(interval) =>
|
||||
@@ -556,6 +559,10 @@ export class BrokerageOperationsService {
|
||||
row.payload as TbankOperationItem,
|
||||
row.occurredAt,
|
||||
),
|
||||
logoName:
|
||||
instruments
|
||||
.get(metadataKey(row.payload as TbankOperationItem))
|
||||
?.data?.brand?.logoName?.trim() || null,
|
||||
...(accountId === 'all'
|
||||
? {
|
||||
account: {
|
||||
|
||||
Reference in New Issue
Block a user