Skip to content

Commit

Permalink
fix: quiz api issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pateljannat committed Jan 2, 2025
1 parent ae5ea9a commit be1c0de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 7 additions & 5 deletions frontend/src/components/Quiz.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,17 @@
class="w-3.5 h-3.5 text-gray-900 rounded-sm focus:ring-gray-200"
@change="markAnswer(index)"
/>

<div
v-else-if="quiz.data.show_answers"
v-for="(answer, idx) in showAnswers"
>
<div v-if="index - 1 == idx">
<CheckCircle v-if="answer" class="w-4 h-4 text-green-500" />
<CheckCircle
v-if="answer == 1"
class="w-4 h-4 text-green-500"
/>
<MinusCircle
v-else-if="questionDetails.data[`is_correct_${index}`]"
v-else-if="answer == 2"
class="w-4 h-4 text-green-500"
/>
<XCircle
Expand Down Expand Up @@ -499,8 +501,8 @@ const checkAnswer = () => {
selectedOptions.forEach((option, index) => {
if (option) {
showAnswers[index] = option && data[index]
} else if (questionDetails.data[`is_correct_${index + 1}`]) {
showAnswers[index] = 0
} else if (data[index] == 2) {
showAnswers[index] = 2
} else {
showAnswers[index] = undefined
}
Expand Down
1 change: 0 additions & 1 deletion lms/lms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,6 @@ def get_question_details(question):
for i in range(1, 5):
fields.append(f"option_{i}")
fields.append(f"explanation_{i}")
fields.append(f"is_correct_{i}")

question_details = frappe.db.get_value("LMS Question", question, fields, as_dict=1)
return question_details
Expand Down

0 comments on commit be1c0de

Please sign in to comment.