fix: correct id compute

This commit is contained in:
2022-10-10 15:57:37 +02:00
parent b61fb37e7e
commit 053d9f724b
5 changed files with 73 additions and 76 deletions

View File

@@ -127,7 +127,6 @@ export default class Login extends Vue {
saveResult() {
const responsesFormatted: { score: number; comment?: string; questionId: number }[] = [];
quizStore.responses.forEach((value, key) => {
console.info(key, value);
responsesFormatted.push({
score: value.score ? value.score : 0,
comment: value.comment,

View File

@@ -12,8 +12,7 @@ export default {
})
.then((response) => {
response.data._embedded.questions.forEach(question => {
console.info(question._links.self.href, question, $axios.defaults.baseURL + "/questions/");
question.id = Number(question._links.self.href.replace($axios.defaults.baseURL + "/questions/", ""));
question.id = Number(question._links.self.href.split("/").reverse()[0]);
return question;
});
return response;

View File

@@ -12,7 +12,7 @@ export default {
})
.then((response) => {
response.data._embedded.quizzes.map(quiz => {
quiz.id = Number(quiz._links.self.href.replace($axios.defaults.baseURL + "/quizzes/", ""));
quiz.id = Number(quiz._links.self.href.split("").reverse()[0]);
return quiz;
});
return response;

View File

@@ -47,7 +47,6 @@ export default class Quiz extends VuexModule {
score: response.score
});
}
console.info(this.responses);
const questionsRated = this.questionsRatedPerAxe.get(response.axeId);
if (questionsRated) {
questionsRated