o
    ahW$                     @   s   d dl mZ d dlmZ d dlmZ d dlmZmZ G dd dej	Z
G dd dej	ZG d	d
 d
ej	ZG dd dej	ZG dd dej	ZG dd dej	ZdS )    )models)timezone)date)MinValueValidatorMaxValueValidatorc                   @   s   e Zd ZdZddgZejddZejddZ	ej
ddZejddddZejd	dddZejddd
Zejd	eddZejddZejddZG dd dZdd ZdS )ICICTRegistrantz9Model for ICICT AI Workshop registrants imported from CSV)awaiting_paymentzAwaiting Payment)	completed	CompletedTunique   
max_length)r   blanknull   r   r   r   r   choicesdefaultauto_now_addauto_nowc                   @      e Zd ZdZdZdgZdS )zICICTRegistrant.MetazICICT RegistrantzICICT RegistrantsnameN__name__
__module____qualname__verbose_nameverbose_name_pluralordering r$   r$   6/var/www/html/smartRegister/icict_attendance/models.pyMeta       
r&   c                 C   s   | j  d| j dS )Nz (ID: ))r   registration_idselfr$   r$   r%   __str__   s   zICICTRegistrant.__str__N)r   r   r    __doc__PAYMENT_STATUS_CHOICESr   IntegerFieldr)   	CharFieldr   
EmailFieldemailaffiliationphone_number	TextFieldaddresspayment_statusDateTimeField
created_at
updated_atr&   r,   r$   r$   r$   r%   r      s     r   c                   @   sn   e Zd ZdZejddZe Zej	ddZ
ejdddZejdddZejdd	ZG d
d dZdd ZdS )AttendanceDayz?Model to configure attendance days for the multi-day conferenceTr   r   r   r   z8Whether attendance is currently being taken for this dayr   	help_textr   c                   @   r   )zAttendanceDay.MetazAttendance DayzAttendance Days
day_numberNr   r$   r$   r$   r%   r&   *   r'   r&   c                 C   s   d| j  d| j d| j dS )NzDay z:  (r(   )r>   titler   r*   r$   r$   r%   r,   /   s   zAttendanceDay.__str__N)r   r   r    r-   r   r/   r>   	DateFieldr   r0   r@   r5   descriptionBooleanField	is_activer8   r9   r&   r,   r$   r$   r$   r%   r;   !   s    r;   c                   @   sr   e Zd ZdZejeejddZeje	ejddZ
ejddZejdddZejdddZG dd	 d	Zd
d ZdS )DailyAttendancez3Model to track daily attendance for each registrantattendances)	on_deleterelated_nameTr   r   r   r   c                   @   s"   e Zd ZdZdZddgZdgZdS )zDailyAttendance.MetazDaily AttendancezDaily Attendances
registrantattendance_dayz-checked_in_atN)r   r   r    r!   r"   unique_togetherr#   r$   r$   r$   r%   r&   ;   s
    
r&   c                 C   s&   | j j d| jj d| jd dS )N - r?   %Y-%m-%d %H:%Mr(   )rJ   r   rK   r@   checked_in_atstrftimer*   r$   r$   r%   r,   A   s   &zDailyAttendance.__str__N)r   r   r    r-   r   
ForeignKeyr   CASCADErJ   r;   rK   r8   rO   GenericIPAddressField
ip_addressr5   
user_agentr&   r,   r$   r$   r$   r%   rE   3   s    rE   c                       s   e Zd ZdZejeejddddZej	dddZ
ejdddZejdd	ZG d
d dZdd Z fddZedd Z  ZS )AttendanceConfigurationz2Singleton model to manage attendance configurationTz3The current day for which attendance is being takenrG   r   r   r=   z0Whether attendance checking is currently enabledr<   z=Welcome to ICICT AI Workshop! Please confirm your attendance.z-Message shown to users on the attendance pager   c                   @      e Zd ZdZdZdS )zAttendanceConfiguration.MetazAttendance ConfigurationNr   r   r    r!   r"   r$   r$   r$   r%   r&   N       r&   c                 C      d| j  S )NzAttendance Config - Day: )current_dayr*   r$   r$   r%   r,   R      zAttendanceConfiguration.__str__c                    .   | j stj rtdt j|i | d S )Nz4Only one AttendanceConfiguration instance is allowed)pkrV   objectsexists
ValueErrorsupersaver+   argskwargs	__class__r$   r%   rd   U      zAttendanceConfiguration.savec                 C      | j jdd\}}|S )z*Get or create the attendance configuration   r_   r`   get_or_createclsconfigcreatedr$   r$   r%   
get_config[      z"AttendanceConfiguration.get_config)r   r   r    r-   r   rQ   r;   SET_NULLr\   rC   attendance_enabledr5   welcome_messager8   r:   r&   r,   rd   classmethodrt   __classcell__r$   r$   rh   r%   rV   E   s    rV   c                   @   sp  e Zd ZdZg dZg dZejeej	ddddZ
ejddd	Zejd
dZejeej	ddddZejdeddZejededgeddZejededgeddZejededgeddZejededgeddZejddddZejddddZejddddZejddddZejddZej dddZ!ej"dddZ#G d d! d!Z$d"d# Z%e&d$d% Z'd&S )'WorkshopFeedbackz;Model to collect feedback for the ICICT Workshop/Conference))rl   z1 - Poor)   z2 - Fair)   z3 - Good)   z4 - Very Good)   z5 - Excellent))workshopWorkshop)
conference
Conference)generalzGeneral/Overall	feedbacksT)rG   rH   r   r   r   zName of the participant)r   r=   z Email address of the participant)r=   r   r   r   rl   r   zOverall rating of the session)
validatorsr   r=   zQuality of content presentedz&Effectiveness of the presenter/speakerzQuality of venue and facilitiesz-What did you like most about today's session?)r=   r   r   z-What suggestions do you have for improvement?z5What additional topics would you like to see covered?zAny other comments or feedbackr   rI   Fz*Whether feedback was submitted anonymouslyr<   c                   @   r   )zWorkshopFeedback.MetazWorkshop FeedbackzWorkshop Feedbacksz-submitted_atNr   r$   r$   r$   r%   r&      r'   r&   c                 C   s2   | j r| j jnd}| j d| d| jd dS )NzGeneral FeedbackrM   r?   rN   r(   )rK   r@   participant_namesubmitted_atrP   )r+   day_infor$   r$   r%   r,      s    zWorkshopFeedback.__str__c                 C   s$   | j | j| j| jg}t|t| S )z1Calculate average rating across all rating fields)overall_ratingcontent_qualitypresenter_effectivenessvenue_facilitiessumlen)r+   ratingsr$   r$   r%   average_rating   s   zWorkshopFeedback.average_ratingN)(r   r   r    r-   RATING_CHOICESSESSION_TYPE_CHOICESr   rQ   r   rR   rJ   r0   r   r1   participant_emailr;   rK   session_typer/   r   r   r   r   r   r   r5   what_liked_mostsuggestions_improvementadditional_topicsgeneral_commentsr8   r   rS   rT   rC   is_anonymousr&   r,   propertyr   r$   r$   r$   r%   r{   b   sh    r{   c                       s   e Zd ZdZejdddZejeej	ddddZ
ejdddZejdd	dZejd
ddZejddZG dd dZdd Z fddZedd Z  ZS )FeedbackConfigurationz%Configuration for feedback collectionTz&Whether feedback collection is enabledr<   z1Current day for which feedback is being collectedrW   z3We value your feedback! Please share your thoughts.z.Message shown to participants on feedback formz1Allow participants to submit feedback anonymouslyFzDRequire participants to have attended the day before giving feedbackr   c                   @   rX   )zFeedbackConfiguration.MetazFeedback ConfigurationNrY   r$   r$   r$   r%   r&      rZ   r&   c                 C   r[   )NzFeedback Config - Day: )current_feedback_dayr*   r$   r$   r%   r,      r]   zFeedbackConfiguration.__str__c                    r^   )Nz2Only one FeedbackConfiguration instance is allowed)r_   r   r`   ra   rb   rc   rd   re   rh   r$   r%   rd      rj   zFeedbackConfiguration.savec                 C   rk   )z(Get or create the feedback configurationrl   rm   rn   rp   r$   r$   r%   rt      ru   z FeedbackConfiguration.get_config)r   r   r    r-   r   rC   feedback_enabledrQ   r;   rv   r   r5   feedback_messageallow_anonymous_feedbackrequire_attendancer8   r:   r&   r,   rd   ry   rt   rz   r$   r$   rh   r%   r      s8    r   N)	django.dbr   django.utilsr   datetimer   django.core.validatorsr   r   Modelr   r;   rE   rV   r{   r   r$   r$   r$   r%   <module>   s    \