diff --git a/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.html b/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.html index 2ee0096..fd5c64d 100644 --- a/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.html +++ b/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.html @@ -3,8 +3,8 @@
-

{{(session | async)?.payload?.val()?.body}} Sitzung Nr. {{(session | async)?.payload?.val()?.number}}, - {{(session | async)?.payload?.val()?.date}}

+

{{session?.body}} Sitzung Nr. {{session?.number}}, + {{session?.date}}

diff --git a/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.ts b/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.ts index 33ef4c7..e7e38aa 100644 --- a/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.ts +++ b/projects/speech-statistics/src/app/statistics/session-statistics/session-statistics.component.ts @@ -25,7 +25,7 @@ export class SessionStatisticsComponent implements OnInit, OnDestroy { public readonly longestSpeechPerFaction: Map = new Map(); public readonly proportionOfSpeechTimePerFaction: Map = new Map(); public readonly proportionOfCommentaryTimePerFaction: Map = new Map(); - public session: Observable> = new Observable>(); + public session: Session | undefined; public factionsInCurrentBody: Observable[]> = new Observable[]>(); private sessionKey: string | undefined; @@ -41,7 +41,7 @@ export class SessionStatisticsComponent implements OnInit, OnDestroy { this.sessionKey = this.route.snapshot.params['sessionKey']; const speechTimesRef = this.database.list('speechTimes'); const sessionRef = this.database.object('sessions/' + this.sessionKey); - this.session = sessionRef.snapshotChanges(); + const sessionObservable = sessionRef.snapshotChanges(); this.speechTimes = speechTimesRef.snapshotChanges().pipe( map(speechTimesList => { @@ -50,16 +50,17 @@ export class SessionStatisticsComponent implements OnInit, OnDestroy { ); this.subscriptions.push( - this.speechTimes.subscribe((speechTimes) => this.calculateStatistics(speechTimes)), - this.session.subscribe(session => { + sessionObservable.subscribe(session => { const payload = session.payload.val(); if (payload == null) { return; } + this.session = payload; this.factionsInCurrentBody = this.factionInBodyService.factionsInBodies.pipe( map(list => list.filter(factionInBody => factionInBody.payload.val()?.bodyKey == payload.bodyKey)) ); - }) + }), + this.speechTimes.subscribe((speechTimes) => this.calculateStatistics(speechTimes)), ); }