Skip to content

Commit

Permalink
Don't show duplicate answers in historical attempts.
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Dec 11, 2023
1 parent 1f6232d commit 7f8fb4c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChallengeSubmissionViewModel } from '@/api/challenges.models';
import { Pipe, PipeTransform } from '@angular/core';
import { unique } from 'projects/gameboard-ui/src/tools';

@Pipe({ name: 'indexToSubmittedAnswer' })
export class IndexToSubmittedAnswerPipe implements PipeTransform {
Expand All @@ -17,6 +18,9 @@ export class IndexToSubmittedAnswerPipe implements PipeTransform {
if (hideLastResponse)
displayedSubmissions = displayedSubmissions.slice(0, displayedSubmissions.length - 1);

return displayedSubmissions.map(submission => `${submission.answers[index] ? `"${submission.answers[index]}"` : "(no response)"}`).join(", ");
return unique(
displayedSubmissions
.map(submission => `${submission.answers[index] ? `"${submission.answers[index]}"` : "(no response)"}`)
).join(", ");
}
}

0 comments on commit 7f8fb4c

Please sign in to comment.