fix: codacy linting issues

This commit is contained in:
scmmishra 2019-04-09 12:57:56 +05:30
parent abb35ad308
commit bae2d669b5
4 changed files with 32 additions and 35 deletions

View File

@ -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

View File

@ -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);
});
};
});

View File

@ -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 = `<a class="dropdown-item" href="/lms#/Profile" rel="nofollow"> LMS Profile </a>`
// 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
})
});

View File

@ -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();
}
}
}];