Backend services: - targo-hub: extract deepGetValue to helpers.js, DRY disconnect reasons lookup map, compact CAPABILITIES, consolidate vision.js prompts/schemas, extract dispatch scoring weights, trim section dividers across 9 files - modem-bridge: extract getSession() helper (6 occurrences), resetIdleTimer(), consolidate DM query factory, fix duplicate username fill bug, trim headers (server.js -36%, tplink-session.js -47%, docker-compose.yml -57%) Frontend: - useWifiDiagnostic: extract THRESHOLDS const, split processDiagnostic into 6 focused helpers (processOnlineStatus, processWanIPs, processRadios, processMeshNodes, processClients, checkRadioIssues) - EquipmentDetail: merge duplicate ROLE_LABELS, remove verbose comments Documentation (17 → 13 files, -1,400 lines): - New consolidated README.md (architecture, services, dependencies, auth) - Merge ECOSYSTEM-OVERVIEW into ARCHITECTURE.md - Merge MIGRATION-PLAN + ARCHITECTURE-COMPARE + FIELD-GAP + CHANGELOG → MIGRATION.md - Merge COMPETITIVE-ANALYSIS into PLATFORM-STRATEGY.md - Update ROADMAP.md with current phase status - Delete CONTEXT.md (absorbed into README) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
import pymysql
|
|
conn = pymysql.connect(host='legacy-db', user='facturation', password='VD67owoj',
|
|
database='gestionclient', cursorclass=pymysql.cursors.DictCursor)
|
|
with conn.cursor() as cur:
|
|
cur.execute("""
|
|
SELECT p.category, COUNT(*) as cnt, GROUP_CONCAT(DISTINCT p.sku) as skus
|
|
FROM service s
|
|
JOIN product p ON p.id = s.product_id
|
|
WHERE s.status = 1
|
|
AND p.category NOT IN (4,9,17,21,32,33)
|
|
GROUP BY p.category
|
|
ORDER BY cnt DESC
|
|
""")
|
|
total = 0
|
|
for r in cur.fetchall():
|
|
print("cat={}: {} services — SKUs: {}".format(r["category"], r["cnt"], r["skus"]))
|
|
total += r["cnt"]
|
|
print("\nTotal missing active services: {}".format(total))
|
|
|
|
cur.execute("""
|
|
SELECT p.sku, COUNT(*) as cnt, p.price
|
|
FROM service s
|
|
JOIN product p ON p.id = s.product_id
|
|
WHERE s.status = 1 AND p.category = 26
|
|
GROUP BY p.sku, p.price
|
|
ORDER BY cnt DESC
|
|
""")
|
|
print("\nCategory 26 breakdown:")
|
|
for r in cur.fetchall():
|
|
print(" {} x{} @ {:.2f}".format(r["sku"], r["cnt"], float(r["price"])))
|
|
conn.close()
|