o
    ȟ1i=                     @   sF   d dl mZ d dlmZmZmZmZmZmZm	Z	m
Z
 G dd dZdS )    )get_db)CourseUserParticipantStaff
UserWalletParentEventBursaryDiscountApplicationc                   @   s   e Zd Zdd Zdd ZdS )DashboardServicec                 C   s   t  ;}|t }|t }|t }|t }|t }|t }||||||dW  d    S 1 sAw   Y  d S )N)Ztotal_coursesZtotal_parentsZtotal_participantsZtotal_teachersZtotal_eventbursary_application)	r   queryr   countr   r   r   r	   r
   )selfdbZcourses_countZparents_countZparticipants_countZteachers_countZevent_countr    r   /app/services/dashboard.pyadmin_dashboard   s   $z DashboardService.admin_dashboardc                 C   sV   t  }|ttj|k }d|r|jndiW  d    S 1 s$w   Y  d S )NZwallet_balancer   )r   r   r   filteridfirstwallet_amount)r   user_idr   parentr   r   r   parent_dashboard   s   $z!DashboardService.parent_dashboardN)__name__
__module____qualname__r   r   r   r   r   r   r      s    r   N)core.configr   modelsr   r   r   r   r   r   r	   r
   r   r   r   r   r   <module>   s    (