diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58f9e185..916d3cf6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,9 +38,9 @@ jobs: - name: Set Branch run: | - export APPS_JSON='[{"url": "https://github.com/frappe/lms","branch": "main"}]' + export APPS_JSON='[{"url": "https://github.com/frappe/payments","branch": "version-15"},{"url": "https://github.com/frappe/lms","branch": "main"}]' echo "APPS_JSON_BASE64=$(echo $APPS_JSON | base64 -w 0)" >> $GITHUB_ENV - echo "FRAPPE_BRANCH=version-15" >> $GITHUB_ENV + echo "FRAPPE_BRANCH=version-16" >> $GITHUB_ENV - name: Set Image Tag run: | @@ -61,4 +61,4 @@ jobs: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }} build-args: | "FRAPPE_BRANCH=${{ env.FRAPPE_BRANCH }}" - "APPS_JSON_BASE64=${{ env.APPS_JSON_BASE64 }}" \ No newline at end of file + "APPS_JSON_BASE64=${{ env.APPS_JSON_BASE64 }}" diff --git a/docker/init.sh b/docker/init.sh index ed74f101..edba3170 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -24,6 +24,7 @@ bench set-redis-socketio-host redis://redis:6379 sed -i '/redis/d' ./Procfile sed -i '/watch/d' ./Procfile +bench get-app payments bench get-app lms bench new-site lms.localhost \ @@ -32,6 +33,7 @@ bench new-site lms.localhost \ --admin-password admin \ --no-mariadb-socket +bench --site lms.localhost install-app payments bench --site lms.localhost install-app lms bench --site lms.localhost set-config developer_mode 1 bench --site lms.localhost clear-cache diff --git a/frontend/src/components/Assignment.vue b/frontend/src/components/Assignment.vue index 8740b9cd..7c740529 100644 --- a/frontend/src/components/Assignment.vue +++ b/frontend/src/components/Assignment.vue @@ -17,7 +17,7 @@
- {{ __('Assignment Question') }} + {{ __('Assignment') }}: {{ assignment.data.title }}
{ } } -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], }) } } diff --git a/frontend/src/components/CourseCard.vue b/frontend/src/components/CourseCard.vue index 0e63c036..0c7d6b2d 100644 --- a/frontend/src/components/CourseCard.vue +++ b/frontend/src/components/CourseCard.vue @@ -1,7 +1,7 @@