asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 1 | import frappe |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 2 | |
| 3 | no_cache = 1 |
| 4 | |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 5 | |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 6 | def get_context(context): |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 7 | if frappe.session.user != "Guest": |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 8 | context.all_certifications = get_all_certifications_of_a_member() |
| 9 | context.show_sidebar = True |
| 10 | |
| 11 | |
| 12 | def get_all_certifications_of_a_member(): |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 13 | """Returns all certifications""" |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 14 | all_certifications = [] |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 15 | all_certifications = frappe.db.sql( |
| 16 | """ select cc.name,cc.from_date,cc.to_date,ca.amount,ca.currency |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 17 | from `tabCertified Consultant` cc |
| 18 | inner join `tabCertification Application` ca |
| 19 | on cc.certification_application = ca.name |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 20 | where paid = 1 and email = %(user)s order by cc.to_date desc""", |
| 21 | {"user": frappe.session.user}, |
| 22 | as_dict=True, |
| 23 | ) |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 24 | return all_certifications |