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

Remove useless code

parent 44376154
No related merge requests found
...@@ -33,50 +33,3 @@ export class StatisticsComponent implements OnInit { ...@@ -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
}
*/
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