o
    i                     @   s   d dl Z d dlZd dlZd dlmZ d dlmZ d dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZ e  dd	 Zed
krDe  dS dS )    N)datetime)load_dotenv)Credentials)send_slack_message)PigeonCloud)load_environment_variablesc                  C   sR  t  } td}dg}tj||d}t|}td}d}||}|d}|	|}	dd |	D }
d	}|
D ]b}|d
7 }|d }|d	 }|d }|d }|d }|d }|d }|d }|d }|s| 
|||||||| t }|d}|}d}|}|||| t| d td	 q8t| d q8d}td}t|| d S )NPROD_SERVICE_ACCOUNT_FILEz,https://www.googleapis.com/auth/spreadsheets)scopesSCHEDULE_CHANGE_SPREADSHEET_IDzA3:O3000u   【RPA】日程追加c                 S   s   g | ]
}|d    r|qS )r   )strip).0row r   @/var/www/html/status_management/src/workflows/schedule_change.py
<listcomp>'   s    z#schedule_change.<locals>.<listcomp>      r                        z%Y/%m/%d   u   列 掲載完了u   列 掲載済み日程u$   日程掲載が完了しました。WEBHOOK_URL_CS_NOTICE)r   osgetenvr   from_service_account_filegspread	authorizeopen_by_key	worksheetgetadd_orientation_dater   nowstrftimeupdate_cellprinttimesleepr   )pigeonr   SCOPEScredsclientr
   
RANGE_NAMEsheetr"   schedule_valuesfiltered_values	row_countcompany_valuejob_idorientation_day
start_timeend_timelocationmax_capacitydeadlinenew_taskregister_checktodayformatted_datecell_rowcell_col	new_valuemessagewebhook_urlr   r   r   schedule_change   sL   







rE   __main__)r   sysr)   r   dotenvr   r   google.oauth2.service_accountr   services.my_slackr   services.pigeon_cloudr   config.load_envr   rE   __name__r   r   r   r   <module>   s    D
