mirror of
https://github.com/frappe/lms.git
synced 2026-04-19 22:52:29 +03:00
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-ink-gray-9 font-semibold mb-5">
|
||||
{{ __('Assignment Question') }}
|
||||
{{ __('Assignment') }}: {{ assignment.data.title }}
|
||||
</div>
|
||||
<div
|
||||
v-html="assignment.data.question"
|
||||
@@ -300,7 +300,7 @@ const submitAssignment = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const addNewSubmission = () => {
|
||||
const prepareSubmissionDoc = () => {
|
||||
let doc = {
|
||||
doctype: 'LMS Assignment Submission',
|
||||
assignment: props.assignmentID,
|
||||
@@ -311,24 +311,31 @@ const addNewSubmission = () => {
|
||||
} else {
|
||||
doc.assignment_attachment = attachment.value
|
||||
}
|
||||
return doc
|
||||
}
|
||||
|
||||
const addNewSubmission = () => {
|
||||
let doc = prepareSubmissionDoc()
|
||||
if (!doc.assignment_attachment && !doc.answer) {
|
||||
toast.error(
|
||||
__('Please provide an answer or upload a file before submitting.')
|
||||
)
|
||||
return
|
||||
}
|
||||
call('frappe.client.insert', {
|
||||
doc: doc,
|
||||
})
|
||||
.then((data) => {
|
||||
toast.success(__('Assignment submitted successfully'))
|
||||
if (router.currentRoute.value.name == 'AssignmentSubmission') {
|
||||
router.push({
|
||||
name: 'AssignmentSubmission',
|
||||
params: {
|
||||
assignmentID: props.assignmentID,
|
||||
submissionName: data.name,
|
||||
},
|
||||
query: { fromLesson: router.currentRoute.value.query.fromLesson },
|
||||
})
|
||||
} else {
|
||||
markLessonProgress()
|
||||
router.go()
|
||||
}
|
||||
router.push({
|
||||
name: 'AssignmentSubmission',
|
||||
params: {
|
||||
assignmentID: props.assignmentID,
|
||||
submissionName: data.name,
|
||||
},
|
||||
query: { fromLesson: router.currentRoute.value.query.fromLesson },
|
||||
})
|
||||
markLessonProgress()
|
||||
isDirty.value = false
|
||||
submissionResource.name = data.name
|
||||
submissionResource.reload()
|
||||
@@ -372,15 +379,17 @@ const saveSubmission = (file) => {
|
||||
}
|
||||
|
||||
const markLessonProgress = () => {
|
||||
if (router.currentRoute.value.name == 'Lesson') {
|
||||
let courseName = router.currentRoute.value.params.courseName
|
||||
let chapterNumber = router.currentRoute.value.params.chapterNumber
|
||||
let lessonNumber = router.currentRoute.value.params.lessonNumber
|
||||
let pathname = window.location.pathname.split('/')
|
||||
if (!pathname.includes('courses'))
|
||||
pathname = window.parent.location.pathname.split('/')
|
||||
if (pathname[2] != 'courses') return
|
||||
let lessonIndex = pathname.pop().split('-')
|
||||
|
||||
if (lessonIndex.length == 2) {
|
||||
call('lms.lms.api.mark_lesson_progress', {
|
||||
course: courseName,
|
||||
chapter_number: chapterNumber,
|
||||
lesson_number: lessonNumber,
|
||||
course: pathname[3],
|
||||
chapter_number: lessonIndex[0],
|
||||
lesson_number: lessonIndex[1],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +224,7 @@
|
||||
</div>
|
||||
<div class="flex items-center justify-between mt-8">
|
||||
<Checkbox
|
||||
v-if="!quiz.data.show_answers"
|
||||
:label="__('Mark for review')"
|
||||
:model-value="reviewQuestions.includes(activeQuestion) ? 1 : 0"
|
||||
@change="markForReview($event, activeQuestion)"
|
||||
@@ -278,6 +279,7 @@
|
||||
!showAnswers.length &&
|
||||
questionDetails.data.type != 'Open Ended'
|
||||
"
|
||||
class="ml-auto"
|
||||
@click="checkAnswer()"
|
||||
>
|
||||
<span>
|
||||
@@ -289,12 +291,18 @@
|
||||
activeQuestion != questions.length && quiz.data.show_answers
|
||||
"
|
||||
@click="nextQuestion()"
|
||||
class="ml-auto"
|
||||
>
|
||||
<span>
|
||||
{{ __('Next') }}
|
||||
</span>
|
||||
</Button>
|
||||
<Button variant="solid" v-else @click="handleSubmitClick()">
|
||||
<Button
|
||||
variant="solid"
|
||||
v-else
|
||||
@click="handleSubmitClick()"
|
||||
class="ml-auto"
|
||||
>
|
||||
<span>
|
||||
{{ __('Submit') }}
|
||||
</span>
|
||||
@@ -891,10 +899,14 @@ const markLessonProgress = () => {
|
||||
}
|
||||
|
||||
const handleSubmitClick = () => {
|
||||
if (attemptedQuestions.value.length) {
|
||||
switchQuestion(activeQuestion.value)
|
||||
if (!quiz.data.show_answers) {
|
||||
if (attemptedQuestions.value.length) {
|
||||
switchQuestion(activeQuestion.value)
|
||||
}
|
||||
showSubmissionConfirmation.value = true
|
||||
} else {
|
||||
submitQuiz()
|
||||
}
|
||||
showSubmissionConfirmation.value = true
|
||||
}
|
||||
|
||||
const paginationWindow = computed(() => {
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div v-if="assignments.hasNextPage" class="h-8 border-l"></div>
|
||||
<div class="text-ink-gray-5">
|
||||
{{ assignments.data?.length }} {{ __('of') }}
|
||||
{{ totalAssignments.data }} {{ __('Assignments') }}
|
||||
{{ totalAssignments.data }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -123,7 +123,6 @@
|
||||
<div v-if="exercises.hasNextPage" class="h-8 border-l"></div>
|
||||
<div class="text-ink-gray-5">
|
||||
{{ exercises.data?.length }} {{ __('of') }} {{ totalExercises.data }}
|
||||
{{ __('Exercises') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,11 +20,12 @@
|
||||
"section_break_ydgh",
|
||||
"column_break_oqqy",
|
||||
"status",
|
||||
"question",
|
||||
"column_break_tbnv",
|
||||
"comments",
|
||||
"section_break_rqal",
|
||||
"question",
|
||||
"column_break_esgd",
|
||||
"course",
|
||||
"column_break_esgd",
|
||||
"lesson"
|
||||
],
|
||||
"fields": [
|
||||
@@ -145,13 +146,17 @@
|
||||
{
|
||||
"fieldname": "section_break_ydgh",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_tbnv",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"make_attachments_public": 1,
|
||||
"modified": "2026-02-05 11:38:03.792865",
|
||||
"modified": "2026-04-06 18:24:11.837953",
|
||||
"modified_by": "sayali@frappe.io",
|
||||
"module": "LMS",
|
||||
"name": "LMS Assignment Submission",
|
||||
|
||||
Reference in New Issue
Block a user