Add +-1000 spinner buttons to amount fields, floor (not round) to nearest 1000 in all allocation calculations
Deploy App / deploy (push) Successful in 45s

This commit is contained in:
2026-07-08 20:40:54 +02:00
parent 3b68ff8319
commit fb57ec5549
4 changed files with 75 additions and 36 deletions
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
import { z } from "zod";
import { prisma } from "@/lib/db";
import { computeSecurityYearlyValues } from "@/lib/calculations";
import { floorToThousand } from "@/lib/format";
const transitionItemSchema = z.object({
positionType: z.enum(["SECURITY", "REAL_ESTATE"]),
@@ -132,6 +133,11 @@ export async function PUT(
}
}
// Auf ein Vielfaches von 1'000 abrunden, damit der Betrag ueber Wertschriften
// (die nur in 1'000er-Schritten Sparbeitraege/Startwerte annehmen) vollstaendig
// verteilbar bleibt.
incomingCapital = floorToThousand(incomingCapital);
const transition = await prisma.$transaction(async (tx) => {
await tx.phaseTransition.deleteMany({ where: { fromPhaseId: phaseId } });