From 457fe32b13403d02ab6f7ac6082c28475c0606c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Tue, 4 Dec 2018 21:43:00 +0100 Subject: [PATCH] Remove useless code --- .../shared/statistics/statistics.component.ts | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/src/app/components/shared/statistics/statistics.component.ts b/src/app/components/shared/statistics/statistics.component.ts index d6bcae0b2..cef4ce979 100644 --- a/src/app/components/shared/statistics/statistics.component.ts +++ b/src/app/components/shared/statistics/statistics.component.ts @@ -33,50 +33,3 @@ export class StatisticsComponent implements OnInit { } } - /* - - getAnswers(): void { - for (const c of this.contents) { - this.contentAnswerService.getAnswers(c.id).subscribe( answer => { - [].push.apply(this.textAnswers, answer); - }); - this.contentAnswerService.getAnswers(c.id).subscribe( answer => { - [].push.apply(this.choiceAnswers, answer); - }); - } - } - - showStatistic(value) { // refactor answer class structure for less code and more abstraction - this.statistics = []; - for (const c of this.contents) { - if (value === '1') { - if (c.format === ContentType.TEXT) { - const count = this.countTextAnswers(c.id); - this.statistics.push({ - name: c.subject, answers: count, percent: count * 100 / this.textAnswers.length, - }); - } - } else { - if (c.format === ContentType.CHOICE) { - const count = this.countChoiceAnswers(c.id); - this.statistics.push({ - name: c.subject, answers: count, percent: count * 100 / this.choiceAnswers.length, - }); - } - } - } - this.selected = value; - } - - countTextAnswers(contentId: string): number { - return this.textAnswers.filter(answer => answer.contentId === contentId).length; - } - - countChoiceAnswers(contentId: string): number { - return this.choiceAnswers.filter(answer => answer.contentId === contentId).length; - } - - showEvaluation(index: number) { - // coming with api connection, logic doesnt make sense without knowledge about api - } -*/ -- GitLab