Refactored lms store
diff --git a/erpnext/public/js/education/lms/components/ProgramCard.vue b/erpnext/public/js/education/lms/components/ProgramCard.vue
index d0df94d..53905aa 100644
--- a/erpnext/public/js/education/lms/components/ProgramCard.vue
+++ b/erpnext/public/js/education/lms/components/ProgramCard.vue
@@ -63,7 +63,7 @@
return this.programRoute
},
isEnrolled() {
- return lms.store.enrolledPrograms.has(this.program.name)
+ return lms.store.enrolledPrograms.includes(this.program.name)
}
},
components: {
diff --git a/erpnext/public/js/education/lms/components/TopSectionButton.vue b/erpnext/public/js/education/lms/components/TopSectionButton.vue
index 895cae8..40ec4e5 100644
--- a/erpnext/public/js/education/lms/components/TopSectionButton.vue
+++ b/erpnext/public/js/education/lms/components/TopSectionButton.vue
@@ -28,7 +28,7 @@
methods: {
computeButtons(){
if(this.isLoggedIn){
- if(lms.store.enrolledPrograms.has(this.$route.params.program_name)){
+ if(lms.store.enrolledPrograms.includes(this.$route.params.program_name)){
if(this.$route.name == 'home'){
this.buttonName = 'Explore Courses'
}
@@ -56,7 +56,7 @@
if(this.$route.name == 'home'){
return
}
- else if(this.$route.name == 'program' && lms.store.enrolledPrograms.has(this.$route.params.program_name)){
+ else if(this.$route.name == 'program' && lms.store.enrolledPrograms.includes(this.$route.params.program_name)){
this.$router.push({ name: 'content', params: { program_name: this.$route.params.program_name, course: this.nextCourse, type: this.nextContentType, content: this.nextContent}})
}
else {
diff --git a/erpnext/public/js/education/lms/lms.js b/erpnext/public/js/education/lms/lms.js
index 62cfcc2..8914e7b 100644
--- a/erpnext/public/js/education/lms/lms.js
+++ b/erpnext/public/js/education/lms/lms.js
@@ -9,7 +9,7 @@
var store = {
isLogin: false,
- enrolledPrograms: new Set(),
+ enrolledPrograms: [],
enrolledCourses: {}
}
@@ -23,11 +23,7 @@
updateEnrolledPrograms() {
if(this.isLogin) {
lms.call("get_program_enrollments").then(data => {
- if(data){
- data.forEach(element => {
- this.enrolledPrograms.add(element)
- })
- }
+ if(data) this.enrolledPrograms = data
});
if (lms.debug) console.log('Updated Enrolled Programs', this.enrolledPrograms)
}
diff --git a/erpnext/public/js/education/lms/pages/ProgramPage.vue b/erpnext/public/js/education/lms/pages/ProgramPage.vue
index 6fde566..1c90f73 100644
--- a/erpnext/public/js/education/lms/pages/ProgramPage.vue
+++ b/erpnext/public/js/education/lms/pages/ProgramPage.vue
@@ -40,17 +40,17 @@
// });
},
methods: {
- startCourse() {
- this.getContentForNextCourse()
- .then((data) =>
- this.$router.push(`/Program/${this.program_name}/${data.course}/${data.content_type}/${data.content}`)
- )
- },
- getContentForNextCourse() {
- return lms.call('get_continue_data', {
- program_name: this.program_name
- });
- },
+ // startCourse() {
+ // this.getContentForNextCourse()
+ // .then((data) =>
+ // this.$router.push(`/Program/${this.program_name}/${data.course}/${data.content_type}/${data.content}`)
+ // )
+ // },
+ // getContentForNextCourse() {
+ // return lms.call('get_continue_data', {
+ // program_name: this.program_name
+ // });
+ // },
getProgramDetails() {
return lms.call('get_program_details', {
program_name: this.program_name