Minor Improvements

This commit is contained in:
scmmishra 2018-11-26 16:52:45 +05:30 committed by Aditya Hase
parent 97c994f394
commit 201fec3101
5 changed files with 19 additions and 23 deletions

View File

@ -67,7 +67,7 @@ export default {
},
isLogin() {
return lms.store.checkLogin()
},
}
},
methods: {
iconClass(content_type) {

View File

@ -1,10 +1,6 @@
<template>
<section class='top-section'>
<div class='container'>
<div class='text-center'>
<!-- <img class="main-illustration" src='/assets/erpnext_com/img/erpnext_com_illustration.png'
style='width: 700px;'> -->
</div>
<h1 v-html="title"></h1>
<ul class="list-group">
</ul>

View File

@ -31,22 +31,12 @@ export default {
CardList,
ProgramCard,
TopSectionButton
},
beforeMount() {
// this.updateEnrolledPrograms().then(data => {
// data.forEach(element => {
// this.enrolledPrograms.add(element)
// })
// });
},
mounted() {
this.getPortalDetails().then(data => this.portal = data);
this.getFeaturedPrograms().then(data => this.featuredPrograms = data);
},
methods: {
// updateEnrolledPrograms(){
// return lms.call("get_program_enrollments")
// },
getPortalDetails() {
return lms.call("get_portal_details")
},

View File

@ -1,7 +1,7 @@
<template>
<div>
<TopSection :title="portal.title" :description="portal.description">
<AButton :type="'primary'" :size="'lg'" :route="{ name: 'signup'}">Sign Up</AButton>
<AButton v-if="isLogin" :type="'primary'" :size="'lg'" :route="{ name: 'signup'}">Sign Up</AButton>
</TopSection>
<CardList :title="'All Programs'" :description="''">
<ProgramCard slot="card-list-slot" v-for="item in masterData" :key="item.program.name" :program="item.program" :enrolled="item.is_enrolled"/>
@ -37,15 +37,17 @@ export default {
this.getMaster().then(data => this.masterData = data);
},
methods: {
// updateEnrolledPrograms(){
// return lms.call("get_program_enrollments")
// },
getPortalDetails() {
return lms.call("get_portal_details")
},
getMaster() {
return lms.call("get_all_programs")
}
}
},
computed: {
isLogin() {
return !lms.store.checkLogin()
}
}
};
</script>

View File

@ -214,13 +214,21 @@ def get_course_meta(course_name, program_name):
return {'flag':'Continue', 'content_type': next_item['content_type'], 'content': next_item['content']}
@frappe.whitelist()
def get_program_meta(program_name):
def get_program_progress(program_name):
program = frappe.get_doc("Program", program_name)
program_enrollment = frappe.get_list("Program Enrollment", filters={'student': utils.get_current_student(), 'program': program_name })[0].name
program_meta = {}
if not program_enrollment:
return None
else:
program_meta = {}
progress = []
for course in program.get_all_children():
program_meta[course.course] = get_course_meta(course.course, program_name)
meta = get_course_meta(course.course, program_name)
is_complete = False
if meta['flag'] == "Complete":
is_complete = True
progress.append({'course_name': course.course_name, 'name': course.course, 'is_complete': is_complete})
program_meta['progress'] = progress
program_meta['name'] = program_name
program_meta['program'] = program.program_name
return program_meta