diff --git a/frontend/src/components/Controls/Autocomplete.vue b/frontend/src/components/Controls/Autocomplete.vue index eb9a5b08..980a7fd3 100644 --- a/frontend/src/components/Controls/Autocomplete.vue +++ b/frontend/src/components/Controls/Autocomplete.vue @@ -75,7 +75,7 @@ >
  • @@ -87,7 +87,14 @@ name="item-label" v-bind="{ active, selected, option }" > - {{ option.label }} +
    +
    + {{ option.label }} +
    +
    + {{ option.description }} +
    +
  • diff --git a/frontend/src/components/Controls/Link.vue b/frontend/src/components/Controls/Link.vue index 8ce30846..c5f6f63f 100644 --- a/frontend/src/components/Controls/Link.vue +++ b/frontend/src/components/Controls/Link.vue @@ -118,6 +118,7 @@ const options = createResource({ return { label: option.value, value: option.value, + description: option.description, } }) }, diff --git a/frontend/src/components/Modals/Question.vue b/frontend/src/components/Modals/Question.vue index 231a05f3..74e14f13 100644 --- a/frontend/src/components/Modals/Question.vue +++ b/frontend/src/components/Modals/Question.vue @@ -2,46 +2,92 @@ + diff --git a/frontend/src/pages/QuizCreation.vue b/frontend/src/pages/QuizCreation.vue index b53b835e..90f6fdcb 100644 --- a/frontend/src/pages/QuizCreation.vue +++ b/frontend/src/pages/QuizCreation.vue @@ -3,6 +3,9 @@ class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5" > +
    @@ -10,107 +13,128 @@
    {{ __('Details') }}
    -
    -
    - - - + +
    +
    +
    + + +
    +
    + + +
    -
    - - -
    -
    -
    - -
    -
    - {{ __('Settings') }} -
    -
    - - - -
    -
    - - -
    -
    -
    - {{ __('Questions') }} + +
    +
    + {{ __('Settings') }} +
    +
    + + + +
    - -
    - - - - - - +
    +
    +
    + {{ __('Questions') }} +
    + +
    + - -
    + + + + - {{ item }} -
    -
    - {{ item }} -
    -
    - - -
    + +
    + {{ item }} +
    +
    + {{ item }} +
    +
    + + + +
    +
    - + diff --git a/frontend/src/pages/Quizzes.vue b/frontend/src/pages/Quizzes.vue index e7e75b30..3a678e91 100644 --- a/frontend/src/pages/Quizzes.vue +++ b/frontend/src/pages/Quizzes.vue @@ -3,12 +3,21 @@ class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5" > - + + +
    { + if (!user.data?.is_moderator && !user.data?.is_instructor) { + router.push({ name: 'Courses' }) + } +}) const quizFilter = computed(() => { if (user.data?.is_moderator) return {} @@ -68,6 +85,7 @@ const quizzes = createListResource({ fields: ['name', 'title', 'passing_percentage', 'total_marks'], auto: true, cache: ['quizzes', user.data?.name], + orderBy: 'modified desc', onSuccess(data) { data.forEach((row) => {}) }, diff --git a/lms/lms/doctype/lms_quiz/lms_quiz.py b/lms/lms/doctype/lms_quiz/lms_quiz.py index ef7f6243..33abac89 100644 --- a/lms/lms/doctype/lms_quiz/lms_quiz.py +++ b/lms/lms/doctype/lms_quiz/lms_quiz.py @@ -5,7 +5,7 @@ import json import frappe from frappe import _ from frappe.model.document import Document -from frappe.utils import cstr, comma_and +from frappe.utils import cstr, comma_and, cint from fuzzywuzzy import fuzz from lms.lms.doctype.course_lesson.course_lesson import save_progress from lms.lms.utils import ( @@ -30,12 +30,12 @@ class LMSQuiz(Document): ) def validate_limit(self): - if self.limit_questions_to and self.limit_questions_to >= len(self.questions): + if self.limit_questions_to and cint(self.limit_questions_to) >= len(self.questions): frappe.throw( _("Limit cannot be greater than or equal to the number of questions in the quiz.") ) - if self.limit_questions_to and self.limit_questions_to < len(self.questions): + if self.limit_questions_to and cint(self.limit_questions_to) < len(self.questions): marks = [question.marks for question in self.questions] if len(set(marks)) > 1: frappe.throw(_("All questions should have the same marks if the limit is set.")) @@ -43,10 +43,10 @@ class LMSQuiz(Document): def calculate_total_marks(self): if self.limit_questions_to: self.total_marks = sum( - question.marks for question in self.questions[: self.limit_questions_to] + question.marks for question in self.questions[: cint(self.limit_questions_to)] ) else: - self.total_marks = sum(question.marks for question in self.questions) + self.total_marks = sum(cint(question.marks) for question in self.questions) def autoname(self): if not self.name: