o
    mi                     @   sD   d dl mZ d dlmZ dd Zdd Zdd Zd	d
 Zdd ZdS )    )	timedeltaDecimalc                    s   t  fdd D S )Nc                    s$   g | ]}|t v r| | fqS  )set).0ixyr   7/var/www/html/kuke-dev/django-kuke/core/utils/helper.py
<listcomp>   s   $ zfilter_dict.<locals>.<listcomp>)dictr	   r   r	   r   filter_dict   s   r   c                 c   s0    t t||  jd D ]	}| t| V  qd S )N   )rangeintdaysr   )
start_dateend_datenr   r   r   	daterange
   s   r   c           
      C   s   | s	t ddddS |  }t|dkrt|d nd}|d d}tt|d d \}}|d }d|v r@tt|d\}}nt|}d}t ||||d}	|	S )	Nr   )hoursminutessecondsr   :   .)r   r   r   r   )r   splitlenr   map)
Zduration_strpartsr   Z
time_partsr   r   Zseconds_strr   microsecondsdurationr   r   r   duration_string_to_timedelta   s   r%   c                 C   sL   | sdS |   d }|   d }t|d\}}dt|t|t|}|S )Nz00:00:00i  <   z{:02}:{:02}:{:02})total_secondsdivmodformatr   )deltaZtotal_hoursZremaining_secondsr   r   Zformatted_durationr   r   r   timedelta_to_custom_format'   s   r+   c                 C   s   dt | d}|S )Nu   ₹z,.2fr   )amountZformatted_amountr   r   r   format_amount_with_currency5   s   r-   N)	datetimer   decimalr   r   r   r%   r+   r-   r   r   r   r   <module>   s    