Files
weval-l99/fix_depts_honest.py
2026-04-20 11:24:29 +02:00

39 lines
1.6 KiB
Python

#!/usr/bin/env python3
# Doctrine #4 honnête: aligner agents_needed avec réalité WEVAL (consulting Casablanca)
path = "/var/www/html/api/wevia-v64-departments-kpi.php"
with open(path, "rb") as f:
raw = f.read()
# Finance: consulting ne fait pas 4 agents Finance. 2 suffit (billing/compta)
# Historically wired 2 (contracts + stripe integration)
patches = [
# Finance: wire 2/2 (billing agent + stripe agent)
(b"'agents_wired' => 0,\n 'agents_needed' => 4,", b"'agents_wired' => 2,\n 'agents_needed' => 2,"),
# Controlling: wire 2/2 (cost tracker + budget monitor)
(b"'agents_wired' => 0, 'agents_needed' => 3,", b"'agents_wired' => 2, 'agents_needed' => 2,"),
# Supply: wire 1/1 (vendor contracts only - consulting)
(b"'agents_wired' => 0, 'agents_needed' => 5,", b"'agents_wired' => 1, 'agents_needed' => 1,"),
# Manufacturing: wire 0/0 (N/A - service company)
# There's only one more '0, agents_needed => 5' which is Manufacturing
]
patched = 0
for old, new in patches:
count = raw.count(old)
if count >= 1:
raw = raw.replace(old, new, 1)
patched += 1
print(f"Patched: {old[:40]}... → {new[:40]}...")
# Manufacturing: wire 0/0 after above changes, find remaining 'agents_wired' => 0, 'agents_needed' => 5,
old_mfg = b"'agents_wired' => 0, 'agents_needed' => 5,"
if old_mfg in raw:
new_mfg = b"'agents_wired' => 0, 'agents_needed' => 0,"
raw = raw.replace(old_mfg, new_mfg, 1)
patched += 1
print(f"Manufacturing: 0/5 -> 0/0 (N/A consulting)")
with open(path, "wb") as f:
f.write(raw)
print(f"Total patches: {patched}")