
    si	                     <    d Z ddlmZmZ d Zd Zd Zd Zd Zd Z	y	)
z;
methods.py

This page is used to write reusable methods.

    )RecruitmentRecruitmentSurveyc                     	 | j                   j                  }|j                  j                         xs |j                  j                         S # t
        $ r Y yw xY w)zu
    This method is used to check stage manager, if the employee is also
    recruitment manager it returns true
    F)useremployee_getrecruitment_setexists	stage_set	Exceptionrequestemployees     7/var/www/python-projects/worksol/recruitment/methods.pyis_stagemanagerr      sQ    
<<,,''..0OH4F4F4M4M4OO s   AA 	AAc                     	 | j                   j                  }|j                  j                         S # t        $ r Y yw xY w)zQ
    This method is used to check the employee is recruitment manager or not
    F)r   r   r   r	   r   r   s     r   is_recruitmentmanagerr      s=    <<,,''..00 s   /2 	>>c                 6   	 | j                   j                  }|j                  j                  |j                        j                         xs> |j                  j                  j                  |j                        j                         S # t        $ r Y yw xY w)zE
    This method is used to check the employee manager to this stage.idF)	r   r   stage_managerfilterr   r	   recruitment_idrecruitment_managersr   )r   stager   s      r   stage_managesr   "   s    <<,, &&(++&6==? Y##88??8;;?OVVX	
  s   B	B 	BBc                     	 | j                   j                  }|j                  j                  |j                        j                         S # t        $ r Y yw xY w)zY
    This method is used to check the employee is manager to the current recruitment
    r   F)r   r   r   r   r   r	   r   )r   recruitmentr   s      r   recruitment_managesr   0   sO    <<,,//66(++6FMMOO s   A	A 	AAc                    t         j                  j                  |      }t        |       t        |      k7  rt        j                  j                  |      }|r2|D ]-  }|j                  j                  |       |j                          / | rCt        j                  j                  |       }|D ]  }|j                  j                  |        y y y )Nr   )recruitment_ids)template_id__in)
r   objectsgetlistr   r   r    removesaveadd)upt_template_idstemplate_groupsrec_idrecruitment_objrecruitment_surveyssurveyrec_surveys_templatess          r   update_rec_template_grpr/   ;   s    !))---8Oo!66/77>>v>V- &&--f5 $5$=$=$D$D 0 %E %! 0 <&&**?;<	  7    c                 ~   | j                   j                  j                  j                         xs | j                   j                  j                  j                         xs^ | j                   j                  j
                  j                         xs. | j                   j                  j                  j                         S )zG
    Check the user in any recruitment/onboarding related managers
    )r   r   r
   r	   r   onboardingstage_setonboarding_task)r   s    r   in_all_managersr4   K   s    
 	!!++224 	><<$$44;;=	><<$$88??A	> <<$$44;;=	r0   N)
__doc__recruitment.modelsr   r   r   r   r   r   r/   r4    r0   r   <module>r8      s-    >	< 	r0   