mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
Merge pull request #711 from alphagov/extend-scheduling-to-96-hours
Let jobs be scheduled up to 96 hours in the future
This commit is contained in:
@@ -39,8 +39,8 @@ def _validate_positive_number(value, msg="Not a positive integer"):
|
||||
raise ValidationError(msg)
|
||||
|
||||
|
||||
def _validate_datetime_not_more_than_24_hours_in_future(dte, msg="Date cannot be more than 24hrs in the future"):
|
||||
if dte > datetime.utcnow() + timedelta(hours=24):
|
||||
def _validate_datetime_not_more_than_96_hours_in_future(dte, msg="Date cannot be more than 96hrs in the future"):
|
||||
if dte > datetime.utcnow() + timedelta(hours=96):
|
||||
raise ValidationError(msg)
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ class JobSchema(BaseSchema):
|
||||
@validates('scheduled_for')
|
||||
def validate_scheduled_for(self, value):
|
||||
_validate_datetime_not_in_past(value)
|
||||
_validate_datetime_not_more_than_24_hours_in_future(value)
|
||||
_validate_datetime_not_more_than_96_hours_in_future(value)
|
||||
|
||||
class Meta:
|
||||
model = models.Job
|
||||
|
||||
Reference in New Issue
Block a user