Some checks failed
Server (Postgres) / Build & reinstall (setup) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (1) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (2) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (3) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (4) (push) Has been cancelled
Server (Mariadb) / Build & reinstall (setup) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (1) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (2) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (3) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (4) (push) Has been cancelled
Server (Mariadb) / Coverage Wrap Up (push) Has been cancelled
Lock threads / lock (push) Has been cancelled
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Has been cancelled
Regenerate POT file (translatable strings) / Regenerate POT file (version-16-hotfix) (push) Has been cancelled
Sync translations to hotfix branches / Trigger sync → version-16-hotfix (push) Has been cancelled
Create weekly release pull requests / Release (15) (push) Has been cancelled
Create weekly release pull requests / Release (16) (push) Has been cancelled
28 lines
803 B
Python
28 lines
803 B
Python
import frappe
|
|
from frappe.query_builder.functions import IfNull
|
|
|
|
no_cache = 1
|
|
|
|
|
|
def get_context(context):
|
|
if frappe.session.user != "Guest":
|
|
context.all_certifications = get_all_certifications_of_a_member()
|
|
context.show_sidebar = True
|
|
|
|
|
|
def get_all_certifications_of_a_member():
|
|
"""Returns all certifications"""
|
|
all_certifications = []
|
|
cc = frappe.qb.DocType("Certified Consultant")
|
|
ca = frappe.qb.DocType("Certification Application")
|
|
all_certifications = (
|
|
frappe.qb.from_(cc)
|
|
.inner_join(ca)
|
|
.on(cc.certification_application == ca.name)
|
|
.select(cc.name, cc.from_date, cc.to_date, ca.amount, ca.currency)
|
|
.where((cc.paid == 1) & (cc.email == frappe.session.user))
|
|
.orderby(IfNull(cc.to_date, "0001-01-01"), order=frappe.qb.desc)
|
|
.run(as_dict=True)
|
|
)
|
|
return all_certifications
|