fix(mock-data): Fake-Daten bei leerer DB entfernt — ISMS 0%, Dashboard keine simulierten Trends, Compliance-Hub keine Fallback-Zahlen
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Failing after 29s
CI / test-python-backend-compliance (push) Successful in 33s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 17s
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Failing after 29s
CI / test-python-backend-compliance (push) Successful in 33s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 17s
- ISMS Overview: 14% → 0% bei leerer DB, "not_started" Status, alle Kapitel 0% - Dashboard: 12-Monate simulierte Trend-Historie entfernt - Compliance-Hub: Hardcoded Fallback-Statistiken (474/180/95/120/79/44/558/19) → 0 - SQLAlchemy Bug: `is not None` → `.isnot(None)` in SoA-Query - Hardcoded chapter_7/8_status="pass" → berechnet aus Findings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -164,16 +164,14 @@ async def get_executive_dashboard(db: Session = Depends(get_db)):
|
||||
else:
|
||||
traffic_light = "red"
|
||||
|
||||
# Generate trend data (last 12 months - simulated for now)
|
||||
# Trend data — only show current score, no simulated history
|
||||
trend_data = []
|
||||
now = datetime.utcnow()
|
||||
for i in range(11, -1, -1):
|
||||
month_date = now - timedelta(days=i * 30)
|
||||
trend_score = max(0, min(100, score - (11 - i) * 2 + (5 if i > 6 else 0)))
|
||||
if total > 0:
|
||||
now = datetime.utcnow()
|
||||
trend_data.append(TrendDataPoint(
|
||||
date=month_date.strftime("%Y-%m-%d"),
|
||||
score=round(trend_score, 1),
|
||||
label=month_abbr[month_date.month][:3],
|
||||
date=now.strftime("%Y-%m-%d"),
|
||||
score=round(score, 1),
|
||||
label=month_abbr[now.month][:3],
|
||||
))
|
||||
|
||||
# Get top 5 risks (sorted by severity)
|
||||
@@ -304,21 +302,16 @@ async def get_compliance_trend(
|
||||
|
||||
current_score = ((passing + partial * 0.5) / total) * 100 if total > 0 else 0
|
||||
|
||||
# Generate simulated historical data
|
||||
# Trend data — only current score, no simulated history
|
||||
trend_data = []
|
||||
now = datetime.utcnow()
|
||||
|
||||
for i in range(months - 1, -1, -1):
|
||||
month_date = now - timedelta(days=i * 30)
|
||||
variation = ((i * 7) % 5) - 2
|
||||
trend_score = max(0, min(100, current_score - (months - 1 - i) * 1.5 + variation))
|
||||
|
||||
if total > 0:
|
||||
now = datetime.utcnow()
|
||||
trend_data.append({
|
||||
"date": month_date.strftime("%Y-%m-%d"),
|
||||
"score": round(trend_score, 1),
|
||||
"label": f"{month_abbr[month_date.month]} {month_date.year % 100}",
|
||||
"month": month_date.month,
|
||||
"year": month_date.year,
|
||||
"date": now.strftime("%Y-%m-%d"),
|
||||
"score": round(current_score, 1),
|
||||
"label": f"{month_abbr[now.month]} {now.year % 100}",
|
||||
"month": now.month,
|
||||
"year": now.year,
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user