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() {
|
export async function POST() {
|
||||||
const WD = 'c0000000-0000-0000-0000-000000000200'
|
const WD = 'c0000000-0000-0000-0000-000000000200'
|
||||||
|
const results: string[] = []
|
||||||
|
|
||||||
// Check current state
|
// Delete duplicate Pos 10 Rechtsanwalt
|
||||||
const { rows: before } = await pool.query(
|
const { rowCount: d1 } = await pool.query(
|
||||||
`SELECT id, person_name, position, start_date FROM fp_personalkosten WHERE scenario_id = $1 ORDER BY sort_order`, [WD]
|
`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
|
// Fix umlauts in person names + positions across ALL scenarios
|
||||||
const { rowCount } = await pool.query(
|
const nameFixSql = [
|
||||||
`UPDATE fp_personalkosten SET start_date = '2030-01-01' WHERE scenario_id = $1 AND (position ILIKE '%Datenschutz%' OR position ILIKE '%Recht%Jurist%')`, [WD]
|
"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%'",
|
||||||
const r = await computeFinanzplan(pool, WD)
|
"UPDATE fp_personalkosten SET position = REPLACE(position, 'fuehrer', 'führer') WHERE position LIKE '%fuehrer%'",
|
||||||
return NextResponse.json({
|
]
|
||||||
updated: rowCount,
|
for (const sql of nameFixSql) {
|
||||||
before: before.map(r => ({ pos: r.person_name, role: r.position, start: r.start_date })),
|
const { rowCount } = await pool.query(sql)
|
||||||
cash_m60: r.liquiditaet?.endstand?.m60,
|
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