Ejemplo n.º 1
0
    def _check_marks(self, response, user):
        expiry_date = get_expiration_date(user)
        if expiry_date and expiry_date > timezone.now().date():
            # Offset is currently 1 day if you have marks, regardless of amount.
            mark_offset = timedelta(days=1)
            postponed_registration_start = self.registration_start + mark_offset

            before_expiry = self.registration_start.date() < expiry_date

            if postponed_registration_start > timezone.now() and before_expiry:
                if 'offset' in response and response['offset'] < postponed_registration_start \
                        or 'offset' not in response:
                    response['status'] = False
                    response['status_code'] = 401
                    response['message'] = _(
                        "Din påmelding er utsatt grunnet prikker.")
                    response['offset'] = postponed_registration_start
        return response
Ejemplo n.º 2
0
    def _check_marks(self, response: AttendanceResult,
                     user: User) -> AttendanceResult:
        expiry_date = get_expiration_date(user)
        if expiry_date and expiry_date > timezone.now().date():
            # Offset is currently 1 day if you have marks, regardless of amount.
            mark_offset = timedelta(days=1)
            rule_offset = self.get_minimum_rule_offset_for_user(user)
            postponed_registration_start = (self.registration_start +
                                            rule_offset + mark_offset)

            before_expiry = self.registration_start.date() < expiry_date

            if postponed_registration_start > timezone.now() and before_expiry:
                if (response.offset is not None
                        and response.offset < postponed_registration_start
                        or response.offset is None):
                    response = AttendanceResult(
                        StatusCode.DELAYED_SIGNUP_MARKS,
                        postponed_registration_start,
                    )
        return response
Ejemplo n.º 3
0
    def _check_marks(self, response: dict, user: User):
        expiry_date = get_expiration_date(user)
        if expiry_date and expiry_date > timezone.now().date():
            # Offset is currently 1 day if you have marks, regardless of amount.
            mark_offset = timedelta(days=1)
            rule_offset = self.get_minimum_rule_offset_for_user(user)
            postponed_registration_start = (self.registration_start +
                                            rule_offset + mark_offset)

            before_expiry = self.registration_start.date() < expiry_date

            if postponed_registration_start > timezone.now() and before_expiry:
                if ("offset" in response
                        and response["offset"] < postponed_registration_start
                        or "offset" not in response):
                    response["status"] = False
                    response["status_code"] = 401
                    response["message"] = _(
                        "Din påmelding er utsatt grunnet prikker.")
                    response["offset"] = postponed_registration_start
        return response
Ejemplo n.º 4
0
 def is_marked(self, user):
     expiry_date = get_expiration_date(user)
     return expiry_date and expiry_date > timezone.now().date()