blob: 5d62d60f5ebb09af84cc7d883d947be3e194f16c [file] [log] [blame]
asbasawaraj4c263482018-06-15 10:04:19 +05301import frappe
asbasawaraj4c263482018-06-15 10:04:19 +05302
3no_cache = 1
4
Ankush Menat494bd9e2022-03-28 18:52:46 +05305
asbasawaraj4c263482018-06-15 10:04:19 +05306def get_context(context):
Ankush Menat494bd9e2022-03-28 18:52:46 +05307 if frappe.session.user != "Guest":
asbasawaraj4c263482018-06-15 10:04:19 +05308 context.all_certifications = get_all_certifications_of_a_member()
9 context.show_sidebar = True
10
11
12def get_all_certifications_of_a_member():
Ankush Menat494bd9e2022-03-28 18:52:46 +053013 """Returns all certifications"""
asbasawaraj4c263482018-06-15 10:04:19 +053014 all_certifications = []
Ankush Menat494bd9e2022-03-28 18:52:46 +053015 all_certifications = frappe.db.sql(
16 """ select cc.name,cc.from_date,cc.to_date,ca.amount,ca.currency
asbasawaraj4c263482018-06-15 10:04:19 +053017 from `tabCertified Consultant` cc
18 inner join `tabCertification Application` ca
19 on cc.certification_application = ca.name
Ankush Menat494bd9e2022-03-28 18:52:46 +053020 where paid = 1 and email = %(user)s order by cc.to_date desc""",
21 {"user": frappe.session.user},
22 as_dict=True,
23 )
asbasawaraj4c263482018-06-15 10:04:19 +053024 return all_certifications