Sindbad~EG File Manager

Current Path : /home/numerotech/scans.numerotech.com/scan_v1/core/model/__pycache__/
Upload File :
Current File : //home/numerotech/scans.numerotech.com/scan_v1/core/model/__pycache__/CMEScanModel.cpython-37.pyc

B

�dB"�@s�ddlmZmZmZmZmZmZmZmZm	Z	ddl
mZmZddlm
Z
mZddlmZddlZeejdddd	d
�ZGdd�d�ZdS)
�)	�
create_engine�MetaData�Table�insert�null�select�update�delete�text)�and_�or_)�asc�desc)�appN�DATABASE_URIi�Ti)�	pool_size�
pool_pre_ping�pool_recyclec@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�CMEScanModelc
Csdy4t�|_td|jdtd�|_td|jdtd�|_Wn*tk
r^}zt|�Wdd}~XYnXdS)N�delegates_selsi22T)�autoload�
autoload_with�users)r�metar�enginerr�	Exception�print)�self�e�r�X/home/numerote/conference.numerotech.com/food_kit_scan_badges/core/model/CMEScanModel.py�__init__szCMEScanModel.__init__c
Cs�t��}|dkrNtd|dd|d|ddt|�d�}td	�n,td|dd|d
dt|�d�}td�}|�|�|�|�}	|��|	r�dd
�|	D�nd}	|	r�|	SdSdS)Nrz�select  d.delegate_id, d.delegate_no,d.role,d.full_name,d.email,d.mobile,d.city,d.state,d.membership_no,d.mc_number, d.counter,d.batch,s.signed_by,s.comments,min(s.signed_on) as signed_on, min(s.updated_at) as updated_at,d.conf_id from z d z left join zR s on s.delegate_no = d.delegate_no and d.conf_id = s.conf_id and s.signin_date= 'z' z where d.conf_id = z� and d.delegate_no > 0 and d.delegate_no is not null and d.role not in ('VOLUNTEER','TRADE','EXHIBIOR','CREW','SUPPORT - IT','SUPPORT - AV') group by d.delegate_no order by d.delegate_no  asc;zif blockz> s on s.delegate_no = d.delegate_no and d.conf_id = s.conf_id z SET sql_mode ='' ;cSsg|]}t|��qSr)�dict)�.0�rrrr �
<listcomp>,sz-CMEScanModel.delegateData.<locals>.<listcomp>)r�connectr
�strr�execute�close)
r�conf_id�del_table_name�signup_for_alldays�signup_table�	curr_date�conn�stmt�stmt_2�resultsrrr �delegateDatas2
*

zCMEScanModel.delegateDatac

Cs�t��}|��}	|	�d|||||||g�|	jr�dd�|	jD�}
g}x$|	��D]}|�tt|
|���qNW|	�	�|�
�|r�|SdSn|	�	�|�
�dSdS)N�usp_search_regdesk_v1cSsg|]}|d�qS)rr)r#�columnrrr r%;sz6CMEScanModel.usp_search_regdesk_v1.<locals>.<listcomp>)r�raw_connection�cursor�callproc�description�fetchall�appendr"�zipr)�commit)
rr+�search_data�is_delegater*r-r,r.�
connectionr7�columnsr2�rowrrr r46s z"CMEScanModel.usp_search_regdesk_v1c
Cs�g}
z�t��}|��}|�d|||||||||	g	�xpdd�|jD�}
g}x.|��}|dkr^Ptt|
|��}|�|�qLW|
�t	|��|�
�dkr�P|jdkr6Pq6W|��|��Wd|��X|
S)N�update_android_sync_datacSsg|]}|d�qS)rr)r#�crrr r%Tsz8CMEScanModel.updateAndGetSignedCount.<locals>.<listcomp>)
rr6r7r8r9�fetchoner"r<r;�list�nextsetr)r=)rr*�delegate_nor+�curr_dt�	signed_by�commentsr.r,r-�setsr@r7�names�set_�row_rawrBrrr �updateAndGetSignedCountLs.

z$CMEScanModel.updateAndGetSignedCountc
Cs�g}z�t��}|��}|�d|||||g�xpdd�|jD�}	g}
x.|��}|dkrVPtt|	|��}|
�|�qDW|�t	|
��|�
�dkr�P|jdkr.Pq.W|��|��Wd|��X|S)N�"usp_android_sync_with_signed_countcSsg|]}|d�qS)rr)r#rDrrr r%zsz;CMEScanModel.syncAllDataWithSignedCount.<locals>.<listcomp>)
rr6r7r8r9rEr"r<r;rFrGr)r=)
rr*r+�date_1r,r-rLr@r7rMrNrOrBrrr �syncAllDataWithSignedCountqs.

z'CMEScanModel.syncAllDataWithSignedCountcCsRt��}td�}|j|||d�}|��|r:dd�|D�nd}|rJ|dSdSdS)Nzbselect * from delegates where conference_id =:conference_id and delegate_no =:delegate_no limit 1;)�
conference_idrHcSsg|]}t|��qSr)r")r#r$rrr r%�sz7CMEScanModel.getDelegateDataCMEScan.<locals>.<listcomp>r)rr&r
r(r))rrTrHr/r0r2rrr �getDelegateDataCMEScan�sz#CMEScanModel.getDelegateDataCMEScancCsDt��}tdt|�d�}|�|�}|��|r@dd�|D�SdS)NzGselect country_id,state_id,state_name from states where country_id   = z order by state_name asc;cSsg|]}t|��qSr)r")r#r$rrr r%�sz6CMEScanModel.get_mcstates_of_india.<locals>.<listcomp>)rr&r
r'r(r))r�
country_idr/r0r2rrr �get_mcstates_of_india�s

z"CMEScanModel.get_mcstates_of_indiac
Cs�g}
z�t��}|��}|�d|||||||||	g	�xpdd�|jD�}
g}x.|��}|dkr^Ptt|
|��}|�|�qLW|
�t	|��|�
�dkr�P|jdkr6Pq6W|��|��Wd|��X|
S)NZ$usp_update_delegatedata_from_cmescancSsg|]}|d�qS)rr)r#rDrrr r%�sz7CMEScanModel.updateDelegatedata_cme.<locals>.<listcomp>)
rr6r7r8r9rEr"r<r;rFrGr)r=)rr+�prefix�	full_name�email�mobile�mc_state_id�	mc_numberrHr*rLr@r7rMrNrOrBrrr �updateDelegatedata_cme�s.

z#CMEScanModel.updateDelegatedata_cmecCsBt��}td�}|j||||d�}|��|��}|r:|SdSdS)Nzcselect count(*) from users where user_id <> :user_id and email= :email  and society_id=:society_id;)�user_idrZ�
society_id)rr&r
r(r)rE)rr_rZr`r/r0�resultr2rrr �count_email�szCMEScanModel.count_emailcCsBt��}|j���|jjj�|g���|�}|�	|�}|�
�|S)N)rr&rr�whererDr_�in_�valuesr(r))rr_�datasr/r0rarrr �
update_member�s
$
zCMEScanModel.update_memberc
Cs�g}
z�t��}|��}|�d|||||||||	g	�xpdd�|jD�}
g}x.|��}|dkr^Ptt|
|��}|�|�qLW|
�t	|��|�
�dkr�P|jdkr6Pq6W|��|��Wd|��X|
S)N�update_badge_scan_signupcSsg|]}|d�qS)rr)r#rDrrr r%�sz9CMEScanModel.update_badge_scan_signup.<locals>.<listcomp>)
rr6r7r8r9rEr"r<r;rFrGr)r=)rr*rHr+rIrJrKr.r,r-rLr@r7rMrNrOrBrrr rh�s.

z%CMEScanModel.update_badge_scan_signupN)�__name__�
__module__�__qualname__r!r3r4rPrSrUrWr^rbrgrhrrrr r
s%$#r)�
sqlalchemyrrrrrrrr	r
Zsqlalchemy.sqlrrr
r�corer�json�configrrrrrr �<module>s,

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists