Skip to content

Commit

Permalink
feat: make lease expiration times configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
0x29a committed Jul 16, 2024
1 parent 8b320d6 commit e64bca4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion openassessment/assessment/models/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion openassessment/assessment/models/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,7 @@
}

# disable indexing on history_date
SIMPLE_HISTORY_DATE_INDEX = False
SIMPLE_HISTORY_DATE_INDEX = False

PEER_LEASE_EXPIRATION_HOURS = 8
STAFF_LEASE_EXPIRATION_HOURS = 8

0 comments on commit e64bca4

Please sign in to comment.