diff --git a/erpnext/education/doctype/quiz/quiz.py b/erpnext/education/doctype/quiz/quiz.py index e35a4ef96aa..6da50a6e258 100644 --- a/erpnext/education/doctype/quiz/quiz.py +++ b/erpnext/education/doctype/quiz/quiz.py @@ -13,7 +13,7 @@ class Quiz(Document): try: if len(frappe.get_all("Quiz Activity", {'enrollment': enrollment.name, 'quiz': quiz_name})) >= self.max_attempts: frappe.throw('Maximum attempts reached!') - except: + except Exception as e: pass diff --git a/erpnext/public/js/education/lms/call.js b/erpnext/public/js/education/lms/call.js index 0e6c1868536..e35acbdd752 100644 --- a/erpnext/public/js/education/lms/call.js +++ b/erpnext/public/js/education/lms/call.js @@ -1,15 +1,15 @@ frappe.ready(() => { - frappe.provide('lms'); + frappe.provide('lms'); - lms.call = (method, args) => { - const method_path = 'erpnext.www.lms.' + method; - return new Promise((resolve, reject) => { - return frappe.call({ - method: method_path, - args, - }) - .then(r => resolve(r.message)) - .fail(reject) - }); - } + lms.call = (method, args) => { + const method_path = 'erpnext.www.lms.' + method; + return new Promise((resolve, reject) => { + return frappe.call({ + method: method_path, + args, + }) + .then(r => resolve(r.message)) + .fail(reject); + }); + }; }); \ No newline at end of file diff --git a/erpnext/public/js/education/lms/lms.js b/erpnext/public/js/education/lms/lms.js index 45002cc30f9..9ed5cd772e9 100644 --- a/erpnext/public/js/education/lms/lms.js +++ b/erpnext/public/js/education/lms/lms.js @@ -1,26 +1,25 @@ import Vue from 'vue/dist/vue.js'; -import VueRouter from 'vue-router/dist/vue-router.js' -import moment from 'moment/min/moment.min.js' +import VueRouter from 'vue-router/dist/vue-router.js'; +import moment from 'moment/min/moment.min.js'; import lmsRoot from "./lmsRoot.vue"; import routes from './routes'; import './call'; -Vue.use(VueRouter) +Vue.use(VueRouter); var store = { enrolledPrograms: [], enrolledCourses: [] -} +}; // let profile_page = ` LMS Profile ` // document.querySelector('#website-post-login > ul').innerHTML += profile_page frappe.ready(() => { - frappe.provide('lms') - // frappe.utils.make_event_emitter(lms); + frappe.provide('lms'); - lms.moment = moment + lms.moment = moment; lms.store = new Vue({ data: store, @@ -28,26 +27,24 @@ frappe.ready(() => { updateEnrolledPrograms() { if(this.checkLogin()) { lms.call("get_program_enrollments").then(data => { - this.enrolledPrograms = data + this.enrolledPrograms = data; }); - if (lms.debug) console.log('Updated Enrolled Programs', this.enrolledPrograms) } }, updateEnrolledCourses() { if(this.checkLogin()) { lms.call("get_all_course_enrollments").then(data => { - this.enrolledCourses = data + this.enrolledCourses = data; }) - if (lms.debug) console.log('Updated Enrolled Courses', this.enrolledCourses) } }, checkLogin() { - return frappe.is_user_logged_in() + return frappe.is_user_logged_in(); }, updateState() { - this.checkLogin() - this.updateEnrolledPrograms() - this.updateEnrolledCourses() + this.checkLogin(); + this.updateEnrolledPrograms(); + this.updateEnrolledCourses(); }, checkProgramEnrollment(programName) { if(this.checkLogin()){ @@ -80,6 +77,6 @@ frappe.ready(() => { }); lms.view.$router.afterEach((to, from) => { window.scrollTo(0,0) - }) + }); lms.debug = true -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/erpnext/public/js/education/lms/routes.js b/erpnext/public/js/education/lms/routes.js index 657bc7aeb4c..3bf0e164f99 100644 --- a/erpnext/public/js/education/lms/routes.js +++ b/erpnext/public/js/education/lms/routes.js @@ -50,7 +50,7 @@ const routes = [{ name: 'signup', path: '/Signup', beforeEnter(to, from, next) { - window.location = window.location.origin.toString() + '/login#signup' + window.location = window.location.origin.toString() + '/login#signup'; }, component: Home, props: true @@ -59,7 +59,7 @@ const routes = [{ name: 'login', path: '/Login', beforeEnter(to, from, next) { - window.location = window.location.origin.toString() + '/login#login' + window.location = window.location.origin.toString() + '/login#login'; }, component: Home, props: true @@ -68,7 +68,7 @@ const routes = [{ name: 'logout', path: '/Logout', beforeEnter(to, from, next) { - window.location = window.location.origin.toString() + '/?cmd=web_logout' + window.location = window.location.origin.toString() + '/?cmd=web_logout'; }, component: Home, props: true @@ -82,9 +82,9 @@ const routes = [{ if (!lms.store.checkLogin()) { next({ name: 'home' - }) + }); } else { - next() + next(); } } }];