Fix: Timeline zeigt korrekte historische Zahlen für Artikel, FCs und Quellen
- Dropdown: Gespeicherten fact_check_count statt Live-Filter verwenden - Snapshot: Artikel per collected_at filtern statt immer alle anzeigen - currentView: article_count + fact_check_count an allen 4 Stellen mitgeben - Hero-Stats: Artikel/Quellen/FC-Zähler bei Snapshot-Wechsel aktualisieren - Badges: Quellen- und FC-Badge dynamisch aktualisieren - Hinweis wenn weniger FCs verfügbar als historisch gespeichert Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -37,7 +37,9 @@ var Lagebild = {
|
||||
sources_json: this.data.current_lagebild.sources_json,
|
||||
updated_at: this.data.current_lagebild.updated_at || this.data.generated_at,
|
||||
articles: this.data.articles,
|
||||
fact_checks: this.data.fact_checks
|
||||
fact_checks: this.data.fact_checks,
|
||||
article_count: this.data.incident.article_count,
|
||||
fact_check_count: this.data.incident.factcheck_count
|
||||
};
|
||||
this.render();
|
||||
this.initTabs();
|
||||
@@ -162,8 +164,8 @@ var Lagebild = {
|
||||
|
||||
// Stat Cards (3: Artikel, Quellen, Faktenchecks)
|
||||
var statsHtml = '';
|
||||
statsHtml += this.statCard(this.icons.fileText, '<span class="count-up" data-target="' + d.incident.article_count + '">0</span>', 'Artikel');
|
||||
statsHtml += this.statCard(this.icons.globe, '<span class="count-up" data-target="' + d.incident.source_count + '">0</span>', 'Quellen');
|
||||
statsHtml += this.statCard(this.icons.fileText, '<span class="count-up" id="hero-art-count" data-target="' + d.incident.article_count + '">0</span>', 'Artikel');
|
||||
statsHtml += this.statCard(this.icons.globe, '<span class="count-up" id="hero-src-count" data-target="' + d.incident.source_count + '">0</span>', 'Quellen');
|
||||
statsHtml += this.statCard(this.icons.shieldCheck, '<span class="count-up" id="hero-fc-count" data-target="' + d.incident.factcheck_count + '">0</span>', 'Faktenchecks');
|
||||
document.getElementById('hero-stats').innerHTML = statsHtml;
|
||||
|
||||
@@ -292,7 +294,9 @@ var Lagebild = {
|
||||
sources_json: self.data.current_lagebild.sources_json,
|
||||
updated_at: self.data.current_lagebild.updated_at || self.data.generated_at,
|
||||
articles: self.data.articles,
|
||||
fact_checks: self.data.fact_checks
|
||||
fact_checks: self.data.fact_checks,
|
||||
article_count: self.data.incident.article_count,
|
||||
fact_check_count: self.data.incident.factcheck_count
|
||||
};
|
||||
self.renderCurrentView();
|
||||
} else {
|
||||
@@ -317,7 +321,9 @@ var Lagebild = {
|
||||
sources_json: self.data.current_lagebild.sources_json,
|
||||
updated_at: self.data.current_lagebild.updated_at || self.data.generated_at,
|
||||
articles: self.data.articles,
|
||||
fact_checks: self.data.fact_checks
|
||||
fact_checks: self.data.fact_checks,
|
||||
article_count: self.data.incident.article_count,
|
||||
fact_check_count: self.data.incident.factcheck_count
|
||||
};
|
||||
self.renderCurrentView();
|
||||
} else {
|
||||
@@ -354,7 +360,7 @@ var Lagebild = {
|
||||
h += '<span class="h-timeline-time">' + this.fmtTimeOnly(snap.created_at) + '</span>';
|
||||
h += '<span class="h-timeline-dot"></span>';
|
||||
h += '<span class="h-timeline-meta">' + snap.article_count + ' Artikel</span>';
|
||||
h += '<span class="h-timeline-meta">' + this.getFactChecksAtTime(snap.created_at).length + ' Faktenchecks</span>';
|
||||
h += '<span class="h-timeline-meta">' + (snap.fact_check_count || 0) + ' Faktenchecks</span>';
|
||||
h += '</button>';
|
||||
}
|
||||
h += '</div>';
|
||||
@@ -402,8 +408,10 @@ var Lagebild = {
|
||||
summary: sd.summary,
|
||||
sources_json: sj || [],
|
||||
updated_at: sd.created_at,
|
||||
articles: this.data.articles,
|
||||
fact_checks: this.getFactChecksAtTime(sd.created_at)
|
||||
articles: this.filterArticlesAtTime(sd.created_at),
|
||||
fact_checks: this.getFactChecksAtTime(sd.created_at),
|
||||
article_count: sd.article_count,
|
||||
fact_check_count: sd.fact_check_count
|
||||
};
|
||||
this.allSnapshots[id] = this.currentView;
|
||||
this.renderCurrentView();
|
||||
@@ -419,12 +427,23 @@ var Lagebild = {
|
||||
if (document.getElementById('panel-karte').classList.contains('active')) {
|
||||
this.renderMap();
|
||||
}
|
||||
// Faktencheck-Zaehler aktualisieren (Badge + Hero)
|
||||
var fcCount = (this.currentView.fact_checks || []).length;
|
||||
var fcBadge = document.getElementById('tab-badge-faktenchecks');
|
||||
if (fcBadge) fcBadge.textContent = fcCount;
|
||||
// Counts aktualisieren (Hero + Badges)
|
||||
var articles = this.currentView.articles || [];
|
||||
var artCount = this.currentView.article_count || articles.length;
|
||||
var srcCount = new Set(articles.map(function(a) { return a.source; })).size;
|
||||
var fcCount = this.currentView.fact_check_count || (this.currentView.fact_checks || []).length;
|
||||
|
||||
var heroArt = document.getElementById('hero-art-count');
|
||||
if (heroArt) heroArt.textContent = artCount.toLocaleString('de-DE');
|
||||
var heroSrc = document.getElementById('hero-src-count');
|
||||
if (heroSrc) heroSrc.textContent = srcCount.toLocaleString('de-DE');
|
||||
var heroFc = document.getElementById('hero-fc-count');
|
||||
if (heroFc) heroFc.textContent = fcCount.toLocaleString('de-DE');
|
||||
|
||||
var fcBadge = document.getElementById('tab-badge-faktenchecks');
|
||||
if (fcBadge) fcBadge.textContent = fcCount;
|
||||
var quellenBadge = document.getElementById('tab-badge-quellen');
|
||||
if (quellenBadge) quellenBadge.textContent = srcCount;
|
||||
},
|
||||
|
||||
/* ===== TAB: LAGEBILD ===== */
|
||||
@@ -762,6 +781,14 @@ var Lagebild = {
|
||||
h += '<button class="fc-stat contradicted" data-filter="contradicted"><span class="fc-stat-num">' + contradictedTotal + '</span><span class="fc-stat-label">Widerlegt</span></button>';
|
||||
h += '</div>';
|
||||
|
||||
// Hinweis bei unvollständiger Liste
|
||||
var storedFcCount = this.currentView.fact_check_count || 0;
|
||||
if (storedFcCount > 0 && checks.length < storedFcCount) {
|
||||
h += '<div style="padding:8px 12px;margin:8px 0;background:rgba(200,168,81,0.1);border:1px solid rgba(200,168,81,0.3);border-radius:6px;color:#C8A851;font-size:0.85rem;">';
|
||||
h += checks.length + ' von ' + storedFcCount + ' Faktenchecks verfügbar (ältere wurden bereinigt)';
|
||||
h += '</div>';
|
||||
}
|
||||
|
||||
// Sort: status_history first, then by sources_count
|
||||
checks = checks.slice().sort(function(a, b) {
|
||||
var aH = (a.status_history || []).length;
|
||||
@@ -994,6 +1021,19 @@ var Lagebild = {
|
||||
return filtered;
|
||||
},
|
||||
|
||||
/* ===== ARTIKEL-FILTER NACH ZEITRAUM ===== */
|
||||
filterArticlesAtTime: function(cutoff) {
|
||||
var all = this.data.articles || [];
|
||||
if (!cutoff) return all;
|
||||
var filtered = [];
|
||||
for (var i = 0; i < all.length; i++) {
|
||||
if ((all[i].collected_at || '') <= cutoff) {
|
||||
filtered.push(all[i]);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
},
|
||||
|
||||
/* ===== HILFSFUNKTIONEN ===== */
|
||||
extractDomain: function(url) {
|
||||
if (!url) return null;
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren