chore: fp-patch — delete dup Rechtsanwalt + fix name umlauts
All checks were successful
Build pitch-deck / build-push-deploy (push) Successful in 1m13s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 32s
CI / test-python-voice (push) Successful in 32s
CI / test-bqas (push) Successful in 31s
All checks were successful
Build pitch-deck / build-push-deploy (push) Successful in 1m13s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 32s
CI / test-python-voice (push) Successful in 32s
CI / test-bqas (push) Successful in 31s
This commit is contained in:
@@ -4,21 +4,28 @@ import { computeFinanzplan } from '@/lib/finanzplan/engine'
|
||||
|
||||
export async function POST() {
|
||||
const WD = 'c0000000-0000-0000-0000-000000000200'
|
||||
const results: string[] = []
|
||||
|
||||
// Check current state
|
||||
const { rows: before } = await pool.query(
|
||||
`SELECT id, person_name, position, start_date FROM fp_personalkosten WHERE scenario_id = $1 ORDER BY sort_order`, [WD]
|
||||
)
|
||||
// Delete duplicate Pos 10 Rechtsanwalt
|
||||
const { rowCount: d1 } = await pool.query(
|
||||
`DELETE FROM fp_personalkosten WHERE scenario_id = $1 AND sort_order = 10`, [WD])
|
||||
results.push(`DEL pos 10: ${d1}`)
|
||||
|
||||
// Update ANY row with Datenschutz or Recht in position
|
||||
const { rowCount } = await pool.query(
|
||||
`UPDATE fp_personalkosten SET start_date = '2030-01-01' WHERE scenario_id = $1 AND (position ILIKE '%Datenschutz%' OR position ILIKE '%Recht%Jurist%')`, [WD]
|
||||
)
|
||||
|
||||
const r = await computeFinanzplan(pool, WD)
|
||||
return NextResponse.json({
|
||||
updated: rowCount,
|
||||
before: before.map(r => ({ pos: r.person_name, role: r.position, start: r.start_date })),
|
||||
cash_m60: r.liquiditaet?.endstand?.m60,
|
||||
})
|
||||
// Fix umlauts in person names + positions across ALL scenarios
|
||||
const nameFixSql = [
|
||||
"UPDATE fp_personalkosten SET person_name = REPLACE(person_name, 'Boenisch', 'Bönisch') WHERE person_name LIKE '%Boenisch%'",
|
||||
"UPDATE fp_personalkosten SET position = REPLACE(position, 'Geschaeftsfuehrer', 'Geschäftsführer') WHERE position LIKE '%Geschaeftsfuehrer%'",
|
||||
"UPDATE fp_personalkosten SET position = REPLACE(position, 'Geschaefts', 'Geschäfts') WHERE position LIKE '%Geschaefts%'",
|
||||
"UPDATE fp_personalkosten SET position = REPLACE(position, 'fuehrer', 'führer') WHERE position LIKE '%fuehrer%'",
|
||||
]
|
||||
for (const sql of nameFixSql) {
|
||||
const { rowCount } = await pool.query(sql)
|
||||
if (rowCount && rowCount > 0) results.push(`NAME FIX: ${rowCount}`)
|
||||
}
|
||||
|
||||
// Recompute WD
|
||||
const r = await computeFinanzplan(pool, WD)
|
||||
results.push(`WD cash_m60=${r.liquiditaet?.endstand?.m60}`)
|
||||
|
||||
return NextResponse.json({ ok: true, results })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user