diff --git a/erpnext/public/js/education/lms/components/TopicCard.vue b/erpnext/public/js/education/lms/components/TopicCard.vue
index 883277d061..c9cb94f70c 100644
--- a/erpnext/public/js/education/lms/components/TopicCard.vue
+++ b/erpnext/public/js/education/lms/components/TopicCard.vue
@@ -9,7 +9,7 @@
Content
-
-
+
{{ content.content }}
{{ content.content }}
@@ -35,7 +35,7 @@
import AButton from './Button.vue';
export default {
- props: ['topic', 'course', 'program_name'],
+ props: ['topic', 'course_name', 'program_name'],
name: "TopicCard",
data() {
return {
@@ -51,7 +51,7 @@ export default {
computed: {
firstContentRoute() {
if(lms.store.checkLogin()){
- return `${this.program_name}/${this.course.name}/${this.courseMeta.content_type}/${this.courseMeta.content}`
+ return `${this.program_name}/${this.course}/${this.courseMeta.content_type}/${this.courseMeta.content}`
}
else {
return {}
@@ -93,8 +93,9 @@ export default {
if(content_type == 'Quiz') return 'fa fa-question-circle-o'
},
getCourseMeta() {
- return lms.call('get_course_meta', {
- course_name: this.course.name,
+ return lms.call('get_topic_meta', {
+ topic_name: this.topic.topic_name,
+ course_name: this.course_name,
program_name: this.program_name
})
},
diff --git a/erpnext/public/js/education/lms/pages/CoursePage.vue b/erpnext/public/js/education/lms/pages/CoursePage.vue
index 56656c5be7..eb64ec5add 100644
--- a/erpnext/public/js/education/lms/pages/CoursePage.vue
+++ b/erpnext/public/js/education/lms/pages/CoursePage.vue
@@ -3,7 +3,7 @@
-
+
diff --git a/erpnext/public/js/education/lms/routes.js b/erpnext/public/js/education/lms/routes.js
index 4428c74a8d..7f06c78e51 100644
--- a/erpnext/public/js/education/lms/routes.js
+++ b/erpnext/public/js/education/lms/routes.js
@@ -24,7 +24,7 @@ const routes = [{
},
{
name: 'content',
- path: '/Program/:program_name/:course/:topic/:type/:content',
+ path: '/Program/:program_name/:course_name/:topic/:type/:content',
component: ContentPage,
props: true,
beforeEnter: (to, from, next) => {
diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py
index b8aee4becf..c2a8bd5947 100644
--- a/erpnext/www/lms.py
+++ b/erpnext/www/lms.py
@@ -189,6 +189,33 @@ def get_course_meta(course_name, program_name):
next_item = next(item for item in progress if item['is_complete']==False)
return {'flag':'Continue', 'content_type': next_item['content_type'], 'content': next_item['content']}
+@frappe.whitelist()
+def get_topic_meta(topic_name, course_name, program_name):
+ """
+ Return the porgress of a course in a program as well as the content to continue from.
+ :param topic_name:
+ :param course_name:
+ :param program_name:
+ """
+ print(locals())
+ course_enrollment = utils.get_course_enrollment(course_name)
+ program_enrollment = utils.get_program_enrollment(program_name)
+ student = frappe.get_doc("Student", utils.get_current_student())
+ if not program_enrollment:
+ return None
+ if not course_enrollment:
+ utils.enroll_in_course(course_name, program_name)
+ progress = course_enrollment.get_progress(student)
+ print(progress)
+ count = sum([activity['is_complete'] for activity in progress])
+ if count == 0:
+ return {'flag':'Start Course', 'content_type': progress[0]['content_type'], 'content': progress[0]['content']}
+ elif count == len(progress):
+ return {'flag':'Completed', 'content_type': progress[0]['content_type'], 'content': progress[0]['content']}
+ elif count < len(progress):
+ next_item = next(item for item in progress if item['is_complete']==False)
+ return {'flag':'Continue', 'content_type': next_item['content_type'], 'content': next_item['content']}
+
@frappe.whitelist()
def get_program_progress(program_name):
import math