Skip to content
Snippets Groups Projects
Commit eab03b72 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Make statistics available for participants

parent 8bbc5623
No related merge requests found
...@@ -7,6 +7,8 @@ import { RoomParticipantPageComponent } from './room-participant-page/room-parti ...@@ -7,6 +7,8 @@ import { RoomParticipantPageComponent } from './room-participant-page/room-parti
import { CommentCreatePageComponent } from './comment-create-page/comment-create-page.component'; import { CommentCreatePageComponent } from './comment-create-page/comment-create-page.component';
import { FeedbackBarometerPageComponent } from '../shared/feedback-barometer-page/feedback-barometer-page.component'; import { FeedbackBarometerPageComponent } from '../shared/feedback-barometer-page/feedback-barometer-page.component';
import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component'; import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component';
import { StatisticsPageComponent } from '../shared/statistics-page/statistics-page.component';
import { StatisticComponent } from '../shared/statistic/statistic.component';
const routes: Routes = [ const routes: Routes = [
{ {
...@@ -21,6 +23,18 @@ const routes: Routes = [ ...@@ -21,6 +23,18 @@ const routes: Routes = [
canActivate: [AuthenticationGuard], canActivate: [AuthenticationGuard],
data: { roles: [UserRole.PARTICIPANT] } data: { roles: [UserRole.PARTICIPANT] }
}, },
{
path: 'room/:roomId/statistics',
component: StatisticsPageComponent,
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.PARTICIPANT] }
},
{
path: 'room/:roomId/statistics/:contentId',
component: StatisticComponent,
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.PARTICIPANT] }
},
{ {
path: 'room/:roomId/create-comment', path: 'room/:roomId/create-comment',
component: CommentCreatePageComponent, component: CommentCreatePageComponent,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</p> </p>
</mat-card-content> </mat-card-content>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-grid-list cols="2" rowHeight="2:1"> <mat-grid-list cols="3" rowHeight="2:1">
<mat-grid-tile> <mat-grid-tile>
<button mat-icon-button color="accent" matTooltip="{{ 'room-page.create-comment' | translate}}" <button mat-icon-button color="accent" matTooltip="{{ 'room-page.create-comment' | translate}}"
routerLink="/participant/room/{{ room.id }}/create-comment"> routerLink="/participant/room/{{ room.id }}/create-comment">
...@@ -26,11 +26,13 @@ ...@@ -26,11 +26,13 @@
<mat-icon>thumbs_up_down</mat-icon> <mat-icon>thumbs_up_down</mat-icon>
</button> </button>
</mat-grid-tile> </mat-grid-tile>
<mat-grid-tile>
<button mat-icon-button color="accent" matTooltip="Lernstand"
routerLink="/participant/room/{{ room.shortId }}/statistics">
<mat-icon>insert_chart</mat-icon>
</button>
</mat-grid-tile>
</mat-grid-list> </mat-grid-list>
<mat-card-actions>
<button mat-button color="primary">{{ 'room-page.comments' | translate }}</button>
<button mat-button color="primary">{{ 'room-page.learn' | translate }}</button>
</mat-card-actions>
<app-content-groups *ngIf="room && room.contentGroups" [contentGroups]="room.contentGroups"></app-content-groups> <app-content-groups *ngIf="room && room.contentGroups" [contentGroups]="room.contentGroups"></app-content-groups>
</mat-card> </mat-card>
</div> </div>
......
...@@ -8,8 +8,8 @@ import { NotificationService } from '../../../services/util/notification.service ...@@ -8,8 +8,8 @@ import { NotificationService } from '../../../services/util/notification.service
import { AuthenticationService } from '../../../services/http/authentication.service'; import { AuthenticationService } from '../../../services/http/authentication.service';
import { UserRole } from '../../../models/user-roles.enum'; import { UserRole } from '../../../models/user-roles.enum';
import { User } from '../../../models/user'; import { User } from '../../../models/user';
import {TranslateService} from "@ngx-translate/core"; import { TranslateService } from '@ngx-translate/core';
import {LanguageService} from "../../../services/util/language.service"; import { LanguageService } from '../../../services/util/language.service';
@Component({ @Component({
selector: 'app-comment-list', selector: 'app-comment-list',
......
...@@ -12,15 +12,14 @@ import { NotificationService } from '../../../services/util/notification.service ...@@ -12,15 +12,14 @@ import { NotificationService } from '../../../services/util/notification.service
}) })
export class FeedbackBarometerPageComponent implements OnInit { export class FeedbackBarometerPageComponent implements OnInit {
feedback: any = [ feedback: any = [
{ state: 0, name: 'sentiment_very_satisfied', message: 'I can follow you.', count: 0, }, { state: 0, name: 'sentiment_very_satisfied', message: 'Ich kann folgen.', count: 0, },
{ state: 1, name: 'sentiment_satisfied', message: 'Faster, please!', count: 0, }, { state: 1, name: 'sentiment_satisfied', message: 'Schneller, bitte!', count: 0, },
{ state: 2, name: 'sentiment_neutral', message: 'It\'s ok!', count: 0, }, { state: 2, name: 'sentiment_dissatisfied', message: 'Langsamer, bitte!', count: 0, },
{ state: 3, name: 'sentiment_dissatisfied', message: 'Slower, please!', count: 0, }, { state: 3, name: 'sentiment_very_dissatisfied', message: 'Abgehängt.', count: 0, }
{ state: 4, name: 'sentiment_very_dissatisfied', message: 'You\'ve lost me.', count: 0, },
]; ];
userRole: UserRole; userRole: UserRole;
dummy = [2, 3, 2, 0, 1]; // dummy data -> delete this with api implementation and add get-data dummy = [2, 3, 2, 1]; // dummy data -> delete this with api implementation and add get-data
constructor( constructor(
private authenticationService: AuthenticationService, private authenticationService: AuthenticationService,
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8"> <table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<ng-container matColumnDef="content"> <ng-container matColumnDef="content">
<mat-header-cell *matHeaderCellDef> {{'content.content' | translate}} </mat-header-cell> <mat-header-cell *matHeaderCellDef> {{'statistic.content' | translate}} </mat-header-cell>
<mat-cell *matCellDef="let cp" [ngClass]="{ <mat-cell *matCellDef="let cp" [ngClass]="{
'positiveC' : cp.percent >= status.good, 'positiveC' : cp.percent >= status.good,
'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'okayC' : cp.percent >= status.okay && cp.percent < status.good,
'negativeC' : cp.percent < status.okay, 'negativeC' : cp.percent < status.okay,
'emptyCC' : cp.percent < status.zero }" routerLink="/creator/room/{{ roomId }}/statistics/{{cp.contentId}}">{{cp.content.subject}}</mat-cell> 'emptyCC' : cp.percent < status.zero }" routerLink="{{nextLink}}{{cp.contentId}}">{{cp.content.subject}}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="percentage"> <ng-container matColumnDef="percentage">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
'positiveC' : cp.percent >= status.good, 'positiveC' : cp.percent >= status.good,
'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'okayC' : cp.percent >= status.okay && cp.percent < status.good,
'negativeC' : cp.percent < status.okay, 'negativeC' : cp.percent < status.okay,
'emptyC' : cp.percent < status.zero }" routerLink="/creator/room/{{ roomId }}/statistics/{{cp.contentId}}">{{cp.percent.toFixed() + ' %'}}</mat-cell> 'emptyC' : cp.percent < status.zero }" routerLink="{{nextLink}}{{cp.contentId}}">{{cp.percent.toFixed() + ' %'}}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="counts"> <ng-container matColumnDef="counts">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
'positiveC' : cp.percent >= status.good, 'positiveC' : cp.percent >= status.good,
'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'okayC' : cp.percent >= status.okay && cp.percent < status.good,
'negativeC' : cp.percent < status.okay, 'negativeC' : cp.percent < status.okay,
'emptyC' : cp.percent < status.zero }" routerLink="/creator/room/{{ roomId }}/statistics/{{cp.contentId}}">{{cp.counts}}</mat-cell> 'emptyC' : cp.percent < status.zero }" routerLink="{{nextLink}}{{cp.contentId}}">{{cp.counts}}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="abstentions"> <ng-container matColumnDef="abstentions">
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
'positiveC' : cp.percent >= status.good, 'positiveC' : cp.percent >= status.good,
'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'okayC' : cp.percent >= status.okay && cp.percent < status.good,
'negativeC' : cp.percent < status.okay, 'negativeC' : cp.percent < status.okay,
'emptyC' : cp.percent < status.zero }" routerLink="/creator/room/{{ roomId }}/statistics/{{cp.contentId}}">{{cp.abstentions}}</mat-cell> 'emptyC' : cp.percent < status.zero }" routerLink="{{nextLink}}{{cp.contentId}}">{{cp.abstentions}}</mat-cell>
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
......
...@@ -9,6 +9,8 @@ import { Combination } from '../../../models/round-statistics'; ...@@ -9,6 +9,8 @@ import { Combination } from '../../../models/round-statistics';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service'; import { LanguageService } from '../../../services/util/language.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { AuthenticationService } from '../../../services/http/authentication.service';
import { UserRole } from '../../../models/user-roles.enum';
export class ContentStatistic { export class ContentStatistic {
content: Content; content: Content;
...@@ -47,17 +49,24 @@ export class ListStatisticComponent implements OnInit { ...@@ -47,17 +49,24 @@ export class ListStatisticComponent implements OnInit {
totalP = 0; totalP = 0;
contentCounter = 0; contentCounter = 0;
roomId: number; roomId: number;
nextLink: string;
constructor(private contentService: ContentService, constructor(private contentService: ContentService,
private translateService: TranslateService, private translateService: TranslateService,
protected langService: LanguageService, protected langService: LanguageService,
protected route: ActivatedRoute) { protected route: ActivatedRoute,
protected authService: AuthenticationService) {
langService.langEmitter.subscribe(lang => translateService.use(lang)); langService.langEmitter.subscribe(lang => translateService.use(lang));
} }
ngOnInit() { ngOnInit() {
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
this.roomId = params['roomId']; this.roomId = params['roomId'];
if (this.authService.getRole() === UserRole.CREATOR) {
this.nextLink = `/creator/room/${ this.roomId }/statistics/`;
} else {
this.nextLink = `/participant/room/${ this.roomId }/statistics/`;
}
}); });
this.translateService.use(localStorage.getItem('currentLang')); this.translateService.use(localStorage.getItem('currentLang'));
this.contentService.getContentChoiceByIds(this.contentGroup.contentIds).subscribe(contents => { this.contentService.getContentChoiceByIds(this.contentGroup.contentIds).subscribe(contents => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment