pas.models.attendence ===================== .. py:module:: pas.models.attendence Attributes ---------- .. autoapisummary:: pas.models.attendence.AttendenceType pas.models.attendence.TYPES Classes ------- .. autoapisummary:: pas.models.attendence.Attendence Module Contents --------------- .. py:type:: AttendenceType :canonical: Literal['plenary', 'commission', 'study', 'shortest'] .. py:data:: TYPES :type: dict[AttendenceType, str] .. py:class:: Attendence Bases: :py:obj:`onegov.core.orm.Base`, :py:obj:`onegov.core.orm.mixins.TimestampMixin` Mixin providing created/modified timestamps for all records. The columns are deferred loaded as this is primarily for logging and future forensics. .. py:attribute:: __tablename__ :value: 'pas_attendence' .. py:attribute:: id :type: sqlalchemy.Column[uuid.UUID] .. py:attribute:: date :type: sqlalchemy.Column[datetime.date] .. py:attribute:: duration :type: sqlalchemy.Column[int] .. py:attribute:: type :type: sqlalchemy.Column[AttendenceType] .. py:property:: type_label :type: str .. py:attribute:: parliamentarian_id :type: sqlalchemy.Column[uuid.UUID] .. py:attribute:: parliamentarian :type: sqlalchemy.orm.relationship[onegov.pas.models.parliamentarian.Parliamentarian] .. py:attribute:: commission_id :type: sqlalchemy.Column[uuid.UUID | None] .. py:attribute:: commission :type: sqlalchemy.orm.relationship[onegov.pas.models.commission.Commission | None] .. py:method:: calculate_value() -> decimal.Decimal Calculate the value (in hours) for an attendance record. The calculation follows these business rules: - Plenary sessions: * Always counted as 0.5 (half day), regardless of actual duration This is the special case! - Everything else is counted as actual hours: * First 2 hours are counted as given * After 2 hours, time is rounded to nearest 30-minute increment, * and there is another rate applied for the additional time * Example: 2h 40min would be calculated as 2.5 hours Examples: >>> # Plenary session >>> attendence.type = 'plenary' >>> calculate_value(attendence) '0.5' >>> # Commission meeting, 2 hours >>> attendence.type = 'commission' >>> attendence.duration = 120 # minutes >>> calculate_value(attendence) '2.0' >>> # Study session, 2h 40min >>> attendence.type = 'study' >>> attendence.duration = 160 # minutes >>> calculate_value(attendence) '2.5' .. py:method:: __repr__() -> str