
     Ji                          G d  d      Z y)c                   $    e Zd ZdZddZd Zd Zy)TonyCallServicez0
    Business logic for TonyCall endpoints.
    Nc                     || _         y N)user)selfr   s     O/var/www/html/dp2/backend_v2.1/server/apps/calls/services/tony_call_services.py__init__zTonyCallService.__init__   s	    	    c                     | j                   |j                         S | j                   j                  r|S t        | j                   dd      }|r|j	                  |      S |j                         S )z\
        Apply company scoping: superuser sees all, others see only active_company.
        Nactive_companycompany)r   noneis_superusergetattrfilter)r   qsr   s      r   scope_queryset_to_userz&TonyCallService.scope_queryset_to_user	   s_     9977999!!I ,<dC99^944wwyr
   c                     | j                   |j                         S t        | j                   dd      }|s|j                         S |j                  |      j	                         }d|xs diS )zE
        Compute a small summary for list filtering results.
        Nr   r   total_calls    )r   r   r   r   count)r   r   r   r   s       r   	summarizezTonyCallService.summarize   sk     99779 ,<dC779iii7==? ;+!
 	
r
   r   )__name__
__module____qualname____doc__r	   r   r    r
   r   r   r      s     
r
   r   N)r   r   r
   r   <module>r      s   (
 (
r
   