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> </header>
<main class="container"> <main class="container">
<div class="row mt-3"> <div class="row mt-3">
<h1>{{(session | async)?.payload?.val()?.body}} Sitzung Nr. {{(session | async)?.payload?.val()?.number}}, <h1>{{session?.body}} Sitzung Nr. {{session?.number}},
{{(session | async)?.payload?.val()?.date}}</h1> {{session?.date}}</h1>
<table class="table"> <table class="table">
<thead> <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 longestSpeechPerFaction: Map<string, Speech> = new Map<string, Speech>();
public readonly proportionOfSpeechTimePerFaction: Map<string, number> = new Map<string, number>(); public readonly proportionOfSpeechTimePerFaction: Map<string, number> = new Map<string, number>();
public readonly proportionOfCommentaryTimePerFaction: 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>[]>(); public factionsInCurrentBody: Observable<SnapshotAction<FactionInBody>[]> = new Observable<SnapshotAction<FactionInBody>[]>();
private sessionKey: string | undefined; private sessionKey: string | undefined;
@ -41,7 +41,7 @@ export class SessionStatisticsComponent implements OnInit, OnDestroy {
this.sessionKey = this.route.snapshot.params['sessionKey']; this.sessionKey = this.route.snapshot.params['sessionKey'];
const speechTimesRef = this.database.list<Speech>('speechTimes'); const speechTimesRef = this.database.list<Speech>('speechTimes');
const sessionRef = this.database.object<Session>('sessions/' + this.sessionKey); const sessionRef = this.database.object<Session>('sessions/' + this.sessionKey);
this.session = sessionRef.snapshotChanges(); const sessionObservable = sessionRef.snapshotChanges();
this.speechTimes = speechTimesRef.snapshotChanges().pipe( this.speechTimes = speechTimesRef.snapshotChanges().pipe(
map(speechTimesList => { map(speechTimesList => {
@ -50,16 +50,17 @@ export class SessionStatisticsComponent implements OnInit, OnDestroy {
); );
this.subscriptions.push( this.subscriptions.push(
this.speechTimes.subscribe((speechTimes) => this.calculateStatistics(speechTimes)), sessionObservable.subscribe(session => {
this.session.subscribe(session => {
const payload = session.payload.val(); const payload = session.payload.val();
if (payload == null) { if (payload == null) {
return; return;
} }
this.session = payload;
this.factionsInCurrentBody = this.factionInBodyService.factionsInBodies.pipe( this.factionsInCurrentBody = this.factionInBodyService.factionsInBodies.pipe(
map(list => list.filter(factionInBody => factionInBody.payload.val()?.bodyKey == payload.bodyKey)) map(list => list.filter(factionInBody => factionInBody.payload.val()?.bodyKey == payload.bodyKey))
); );
}) }),
this.speechTimes.subscribe((speechTimes) => this.calculateStatistics(speechTimes)),
); );
} }