From e64bca42c4f469f3b608dd6b77f8a9b8315d25a8 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Tue, 16 Jul 2024 12:51:06 +0200 Subject: [PATCH] feat: make lease expiration times configurable --- openassessment/assessment/models/peer.py | 3 ++- openassessment/assessment/models/staff.py | 3 ++- settings/base.py | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openassessment/assessment/models/peer.py b/openassessment/assessment/models/peer.py index de3db261f9..89433a4280 100644 --- a/openassessment/assessment/models/peer.py +++ b/openassessment/assessment/models/peer.py @@ -13,6 +13,7 @@ import logging import random +from django.conf import settings from django.db import DatabaseError, models from django.utils.timezone import now @@ -108,7 +109,7 @@ class PeerWorkflow(models.Model): """ # Amount of time before a lease on a submission expires - TIME_LIMIT = timedelta(hours=8) + TIME_LIMIT = timedelta(hours=settings.PEER_LEASE_EXPIRATION_HOURS) student_id = models.CharField(max_length=40, db_index=True) item_id = models.CharField(max_length=255, db_index=True) diff --git a/openassessment/assessment/models/staff.py b/openassessment/assessment/models/staff.py index a2557ea9e5..19399fdb49 100644 --- a/openassessment/assessment/models/staff.py +++ b/openassessment/assessment/models/staff.py @@ -6,6 +6,7 @@ from datetime import timedelta import logging +from django.conf import settings from django.db import DatabaseError, models from django.utils.timezone import now @@ -28,7 +29,7 @@ class StaffWorkflow(models.Model): """ # Amount of time before a lease on a submission expires - TIME_LIMIT = timedelta(hours=8) + TIME_LIMIT = timedelta(hours=settings.STAFF_LEASE_EXPIRATION_HOURS) scorer_id = models.CharField(max_length=40, db_index=True, blank=True) course_id = models.CharField(max_length=255, db_index=True) diff --git a/settings/base.py b/settings/base.py index 06c413d0fd..3e6198e06e 100644 --- a/settings/base.py +++ b/settings/base.py @@ -179,4 +179,7 @@ } # disable indexing on history_date -SIMPLE_HISTORY_DATE_INDEX = False \ No newline at end of file +SIMPLE_HISTORY_DATE_INDEX = False + +PEER_LEASE_EXPIRATION_HOURS = 8 +STAFF_LEASE_EXPIRATION_HOURS = 8