HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/buyercall/lib/__pycache__/util_query.cpython-310.pyc
o

we�@s4ddlmZddlZddlZddd�Zd	dd�ZdS)
�)�and_NFcCs�|r|r|j�|j|k��t|j|k|j|k��}n-|r,|j�|j|k��|j|k�}n|r>|j�|j|k��|j|k�}n	|j�|j|k�}|rM|��S|��S)z�
    Get the result_objects in a particular partnership account of id: `paid`.
    if count_only = True, return the count instead of objects.
    )�query�filter�partnership_account_idr�
created_on�count�all)�cls�paid�
count_only�	from_date�to_date�results�r�:/home/arjun/projects/buyercall/buyercall/lib/util_query.py�get_by_partnership_accounts&����rc
Cs�|rH|dkrtjtjd�}|jdd�}t|||||�S|dkrBtjtjd�}|jd}|jdd�}|j|dd�}|}	t|||||	�St|||�St|||�S)zV
    :param date_range_expr: tpye:string, possible values: this_month, last_month
    �
this_month)�tz�)�day�
last_month)�monthr)�pendulum�today�pytz�utc�replacerr)
r	r
r�date_range_exprr�	first_day�	pre_month�first_day_this_month�first_day_pre_month�last_day_pre_monthrrr�get_by_partnership_account_exprs
r#)FNN)FN)�
sqlalchemyrrrrr#rrrr�<module>s