refactor: handle api models identifiers

This commit is contained in:
2022-10-10 10:29:25 +02:00
parent baccbf8d56
commit 09ff7433ed
9 changed files with 32 additions and 27 deletions

View File

@@ -64,11 +64,6 @@ export default class Quiz extends Vue {
})
public color !: string;
// private responses = new Map<string, {
// score?: number;
// comment?: string | null
// }>();
get cssVars() {
return {
'--color': this.color
@@ -76,21 +71,21 @@ export default class Quiz extends Vue {
}
onRate(score: number, question: Question) {
quizStore.updateScoreResponse({axeId: this.axeNumber, questionId: question._links.self.href, score});
quizStore.updateScoreResponse({axeId: this.axeNumber, questionId: question.id, score});
this.emitRatingState();
}
onComment(comment: string, question: Question) {
quizStore.updateCommentResponse({axeId: this.axeNumber, questionId: question._links.self.href, comment});
quizStore.updateCommentResponse({axeId: this.axeNumber, questionId: question.id, comment});
}
getCurrentScore(question: Question): number | undefined {
const rate = quizStore.responses.get(question._links.self.href) as QuizRate;
const rate = quizStore.responses.get(question.id) as QuizRate;
return rate ? rate.score : undefined;
}
getCurrentComment(question: Question): string | undefined {
const rate = quizStore.responses.get(question._links.self.href) as QuizRate;
const rate = quizStore.responses.get(question.id) as QuizRate;
return rate ? rate.comment : undefined;
}