Sindbad~EG File Manager

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

o

Ҽ�ex)�@s�ddlmZmZmZmZmZmZmZmZm	Z	ddl
mZmZddlm
Z
mZddlmZddlZeejdddd	dd
�Zeejdddd	dd
�ZGdd
�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_recycle�future�DATABASE_URI_CONFc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�CMEScanModelc
CsPzt�|_td|jtd�|_WdSty'}zt|�WYd}~dSd}~ww)N�users)�
autoload_with)r�metar�enginer�	Exception�print)�self�e�r�X/home/numerote/conference.numerotech.com/food_kit_scan_badges/core/model/CMEScanModel.py�__init__s��zCMEScanModel.__init__cCs�t���n}t��}|dkr,td|dd|d|ddt|�d�}td	�ntd|dd|d
dt|�d�}	td�}|�|�|�|���}	|	r\dd
�|	D�nd}
|
ri|
Wd�S	Wd�dS1suwYdS)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 ='' ;cS�g|]}t|j��qSr��dict�_mapping��.0�rrrr �
<listcomp>+�z7CMEScanModel.delegateDataForCMEScan.<locals>.<listcomp>)r�connectr
�strr�execute�all)r�conf_id�del_table_name�signup_for_alldays�signup_table�	curr_date�conn�stmt�stmt_2�result�resultsrrr �delegateDataForCMEScansX
��������
������
�$�z#CMEScanModel.delegateDataForCMEScanc

Cs�t��}|��}	|	�d|||||||g�|	jrAdd�|	jD�}
g}|	��D]}|�tt|
|���q&|	�	�|�
�|r?|SdS|	�	�|�
�dS)N�usp_search_regdesk_v1cS�g|]}|d�qS�rr)r'�columnrrr r)8�z6CMEScanModel.usp_search_regdesk_v1.<locals>.<listcomp>)�engine_conf�raw_connection�cursor�callproc�description�fetchall�appendr$�zip�close�commit)
rr0�search_data�is_delegater/r2r1r3�
connectionrA�columnsr8�rowrrr r:3s z"CMEScanModel.usp_search_regdesk_v1c
C��g}
z]t��}|��}|�d|||||||||	g	�	dd�|jD�}
g}	|��}|dur/n
tt|
|��}|�|�q&|
�t	|��|�
�durJn|jdurPnq|��|��W|��|
S|��w)NZupdate_android_sync_data�cSr;r<r�r'�crrr r)Qr>z8CMEScanModel.updateAndGetSignedCount.<locals>.<listcomp>�
r?r@rArBrC�fetchoner$rFrE�list�nextsetrGrH�rr/�delegate_nor0�curr_dt�	signed_by�commentsr3r1r2�setsrKrA�names�set_�row_rawrMrrr �updateAndGetSignedCountI�4
�
�

�z$CMEScanModel.updateAndGetSignedCountc
Cs�g}zYt��}|��}|�d|||||g�	dd�|jD�}	g}
	|��}|dur+n
tt|	|��}|
�|�q"|�t	|
��|�
�durFn|jdurLnq|��|��W|��|S|��w)NZ"usp_android_sync_with_signed_countrOcSr;r<rrPrrr r)wr>z;CMEScanModel.syncAllDataWithSignedCount.<locals>.<listcomp>rR)
rr/r0�date_1r1r2r[rKrAr\r]r^rMrrr �syncAllDataWithSignedCountns4
�
�

�z'CMEScanModel.syncAllDataWithSignedCountcCs�t���7}tdt|�dt|�d�}|�|���}|r%dd�|D�nd}|r2|Wd�S	Wd�dS1s>wYdS)Nz-select * from delegates where conference_id =z and delegate_no =z	 limit 1;cSr"rr#r&rrr r)�r*z7CMEScanModel.getDelegateDataCMEScan.<locals>.<listcomp>�rr+r
r,r-r.)r�
conference_idrWr4r5r7r8rrr �getDelegateDataCMEScan�s
 �$�z#CMEScanModel.getDelegateDataCMEScancCs~t���1}tdt|�d�}|�|���}|rdd�|D�nd}|r,|Wd�S	Wd�dS1s8wYdS)NzGselect country_id,state_id,state_name from states where country_id   = z order by state_name asc;cSr"rr#r&rrr r)�r*z6CMEScanModel.get_mcstates_of_india.<locals>.<listcomp>rc)r�
country_idr4r5r7r8rrr �get_mcstates_of_india�s
�$�z"CMEScanModel.get_mcstates_of_indiac
CrN)NZ$usp_update_delegatedata_from_cmescanrOcSr;r<rrPrrr r)�r>z7CMEScanModel.updateDelegatedata_cme.<locals>.<listcomp>rR)rr0�prefix�	full_name�email�mobile�mc_state_id�	mc_numberrWr/r[rKrAr\r]r^rMrrr �updateDelegatedata_cme�r`z#CMEScanModel.updateDelegatedata_cmecCs�t���3}tdt|�d|dt|�d�}|�|���}|r.t|j�Wd�S	Wd�dS1s:wYdS)Nz5select count(*) as count from users where user_id <> z
 and email= 'z'  and society_id=�;)rr+r
r,r-�one_or_noner$r%)r�user_idrj�
society_idr4r5r8rrr �count_email�s
(�$�zCMEScanModel.count_emailcCs�t���D}z%|j���|jjj�|g���|�}|�	|�}|�
�|WWd�StyG}zt|�WYd}~Wd�Sd}~ww1sKwYdS)N)
rr+rr�whererQrq�in_�valuesr-rHrr,)rrq�datasr4r5r7rrrr �
update_member�s
$
����zCMEScanModel.update_memberc
CrN)N�update_badge_scan_signuprOcSr;r<rrPrrr r)�r>z9CMEScanModel.update_badge_scan_signup.<locals>.<listcomp>rRrVrrr ry�r`z%CMEScanModel.update_badge_scan_signupc	Cs�t���C}|rd|vrtd|d|d�}ntd|d|d|d�}t|�|�|���}|r<dd�|D�nd}|Wd�S1sJwYdS)	N�Allz�select s.delegate_no,d.full_name,d.email,d.mobile,d.state,d.membership_no,d.role,d.mc_number,date_format(s.signin_date, '%d-%m-%Y') as signin_date,s.signed_by,s.signed_on,s.comments from z d inner join zA s on d.conf_id = s.conf_id and d.delegate_no = s.delegate_no   ;zU s on d.conf_id = s.conf_id and d.delegate_no = s.delegate_no where s.signin_date = 'z'   ;cSr"rr#r&rrr r)	r*z9CMEScanModel.getCMEScandelegateRecord.<locals>.<listcomp>)r?r+r
rr-r.)	rr/r0r2�	conf_dater4r5�	results_1r8rrr �getCMEScandelegateRecords
 $�z%CMEScanModel.getCMEScandelegateRecordcCsxt���.}td|dt|�d|d�}|�|���}|r'dd�|D�nd}|Wd�S1s5wYdS)Nz"select signin_date,signed_on from z where conf_id = z and delegate_no = rocSr"rr#r&rrr r)r*z9CMEScanModel.getCMEScanybydelegaateno.<locals>.<listcomp>)r?r+r
r,r-r.)rr/r2rWr4r5r|r8rrr �getCMEScanybydelegaateno
s
$$�z%CMEScanModel.getCMEScanybydelegaatenoN)�__name__�
__module__�__qualname__r!r9r:r_rbrergrnrsrxryr}r~rrrr rs%$

#
#r)�
sqlalchemyrrrrrrrr	r
Zsqlalchemy.sqlrrr
r�corer�json�configrr?rrrrr �<module>s,

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