
    ̪h
                         d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	  ede
      Zej                  ddg      d	        Zej                  d
dg      d        Zy)    )	Blueprintjsonifyrequest)	JobNotice)Exam)ObjectId
job_noticez/get_notices_listGET)methodsc            	      T   t         j                  j                         } i }| D ]  }|j                  }|r|j                  nd}|j
                  |j                  |j                  r|j                  j                  d      nd |j                  r|j                  j                  d      nd |j                  r|j                  j                  d      nd |j                  r|j                  j                  d      nd d}||vrg ||<   ||   j                  |        t        |dd      dfS )NUnknown%Y-%m-%d)titlesummarynotification_dateapplication_start_dateapplication_end_date	exam_dateTdatastatus   )r   objectsselect_relatedexam_id
exam_title	job_titler   r   strftimer   r   r   appendr   )all_noticesgrouped_datanoticeexam	exam_namenotice_datas         2C:\xampp\htdocs\eduruby\routes\job_notification.pyget_grouped_job_noticesr'      s   ##224KL~~'+DOO	 %%~~RXRjRj!9!9!B!B:!Npt\b\y\yf&C&C&L&LZ&X  @DX^XsXsF$?$?$H$H$Ty}BHBRBR))22:>X\
 L(&(L#Y&&{3% ( LD9:C??    z/get_full_noticePOSTc            
         t         j                  j                  d      } | st        ddi      dfS 	 t        j
                  j                  t        |             }|j                  }|r|j                  nd}||j                  |j                  |j                  r|j                  j                  d      nd |j                  r|j                  j                  d      nd |j                  r|j                  j                  d      nd |j                  r|j                  j                  d      nd |j                   |j"                  d	}t        |d	d
      dfS # t        j$                  $ r t        ddi      dfcY S w xY w)N	notice_iderrorzNotice ID is requiredi  )idr   r   )	r$   r   full_contentr   r   r   r   how_to_apply	is_urgentTr   r   zNotice not foundi  )r   jsongetr   r   r   r   r   r   r   r.   r   r   r   r   r   r/   r0   DoesNotExist)r+   r"   r#   r$   full_notices        r&   get_full_noticer5   #   sX     -I!89:C??;""&&(9*=&>~~'+DOO	"))"//RXRjRj!9!9!B!B:!Npt\b\y\yf&C&C&L&LZ&X  @DX^XsXsF$?$?$H$H$Ty}BHBRBR))22:>X\"//))

 t<=sBB!! ;!345s::;s   D$E "E<;E<N)flaskr   r   r   models.job_notice_modelr   models.examr   bsonr   __name__job_notice_bprouter'   r5    r(   r&   <module>r>      sn    - - -  ,1(5':@ ;@4 '&:; ;;r(   