feat(performance): investment performance vs Moscow Exchange index (WealthLedger/main#54) (#200)
This commit was merged in pull request #200.
This commit is contained in:
@@ -11,6 +11,8 @@ import { toJson } from '#src/prisma/to-json';
|
||||
|
||||
import type { PortfolioDto } from '../presentation/portfolio.dto';
|
||||
|
||||
import { isCompleteValuation } from '../domain/complete-valuation';
|
||||
|
||||
const EXPECTED_UPDATED_ACCOUNTS = 1;
|
||||
|
||||
type PortfolioAttempt = {
|
||||
@@ -140,10 +142,7 @@ export class PortfolioRepository {
|
||||
});
|
||||
// Value history points require a fully valued snapshot; the attempt
|
||||
// identity deduplicates repeated or late publications of one attempt.
|
||||
if (
|
||||
snapshot.totalsByCurrency.length > Number.MIN_VALUE &&
|
||||
snapshot.positions.every((position) => position.currentValue !== null)
|
||||
) {
|
||||
if (isCompleteValuation(snapshot)) {
|
||||
await tx.tbankPortfolioValueHistory.upsert({
|
||||
where: {
|
||||
userId_accountId: { userId: attempt.userId, accountId },
|
||||
|
||||
Reference in New Issue
Block a user