Fixed title of session statistics page

This commit is contained in:
Jim Martens 2021-10-05 17:24:55 +02:00
parent 7f1a23a8d8
commit 7a08c007f6
2 changed files with 8 additions and 7 deletions

View File

@ -3,8 +3,8 @@
</header>
<main class="container">
<div class="row mt-3">
<h1>{{(session | async)?.payload?.val()?.body}} Sitzung Nr. {{(session | async)?.payload?.val()?.number}},
{{(session | async)?.payload?.val()?.date}}</h1>
<h1>{{session?.body}} Sitzung Nr. {{session?.number}},
{{session?.date}}</h1>
<table class="table">
<thead>

View File

@ -25,7 +25,7 @@ export class SessionStatisticsComponent implements OnInit, OnDestroy {
public readonly longestSpeechPerFaction: Map<string, Speech> = new Map<string, Speech>();
public readonly proportionOfSpeechTimePerFaction: Map<string, number> = new Map<string, number>();
public readonly proportionOfCommentaryTimePerFaction: Map<string, number> = new Map<string, number>();
public session: Observable<SnapshotAction<Session>> = new Observable<SnapshotAction<Session>>();
public session: Session | undefined;
public factionsInCurrentBody: Observable<SnapshotAction<FactionInBody>[]> = new Observable<SnapshotAction<FactionInBody>[]>();
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<Speech>('speechTimes');
const sessionRef = this.database.object<Session>('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)),
);
}