fix: fixed joining date bug on lms profile

This commit is contained in:
scmmishra 2019-03-28 14:47:22 +05:30
parent 281902f530
commit 9b7ac3e7d2
2 changed files with 13 additions and 5 deletions

View File

@ -10,7 +10,7 @@
<div class="col-md-3 col-sm-4 pr-0 text-muted">Email:</div> <div class="col-md-3 col-sm-4 pr-0 text-muted">Email:</div>
<div class="col-md-9 col-sm-8">{{ email }}</div> <div class="col-md-9 col-sm-8">{{ email }}</div>
</li> </li>
<li class="row"> <li v-if="joiningDate" class="row">
<div class="col-md-3 col-sm-4 pr-0 text-muted">Date of Joining:</div> <div class="col-md-3 col-sm-4 pr-0 text-muted">Date of Joining:</div>
<div class="col-md-9 col-sm-8">{{ joiningDate }}</div> <div class="col-md-9 col-sm-8">{{ joiningDate }}</div>
</li> </li>
@ -43,11 +43,15 @@ export default {
fullName: frappe.full_name, fullName: frappe.full_name,
abbr: frappe.get_abbr(frappe.get_cookie("full_name")), abbr: frappe.get_abbr(frappe.get_cookie("full_name")),
email: frappe.session.user, email: frappe.session.user,
joiningDate: 'fetching...' joiningDate: ''
} }
}, },
mounted(){ mounted(){
this.getJoiningDate().then(data => this.joiningDate = lms.moment(String(data)).format('D MMMM YYYY')) this.getJoiningDate().then(data => {
if(data) {
this.joiningDate = lms.moment(String(data)).format('D MMMM YYYY')
}
})
}, },
computed: { computed: {
avatarStyle() { avatarStyle() {

View File

@ -255,8 +255,12 @@ def get_program_progress(program_name):
@frappe.whitelist() @frappe.whitelist()
def get_joining_date(): def get_joining_date():
student = frappe.get_doc("Student", utils.get_current_student()) current_student = utils.get_current_student()
return student.joining_date if(current_student):
student = frappe.get_doc("Student", current_student)
return student.joining_date
else:
return None
@frappe.whitelist() @frappe.whitelist()
def get_quiz_progress(program_name): def get_quiz_progress(program_name):