Skip to content

Commit

Permalink
Add tag for when grades increment
Browse files Browse the repository at this point in the history
  • Loading branch information
willgearty committed Oct 30, 2020
1 parent 481a1ec commit bf6389a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 9 additions & 0 deletions esp/esp/tagdict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.forms import widgets
from django.core.validators import RegexValidator
from decimal import Decimal
import datetime

from esp.users.forms import _states

Expand Down Expand Up @@ -445,6 +446,14 @@
'category': 'manage',
'is_setting': True,
},
'grade_increment_date': {
'is_boolean': False,
'help_text': 'When should students\' grades rollover/increment?',
'default': datetime.date(datetime.date.today().year, 7, 31),
'category': 'manage',
'is_setting': True,
'field': forms.DateField(widget=forms.SelectDateWidget(years=[datetime.date.today().year]))
},
}

# Any tag used with Tag.getProgramTag()
Expand Down
13 changes: 7 additions & 6 deletions esp/esp/users/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,12 +902,13 @@ def current_schoolyear(now=None):
if now is None:
now = date.today()
curyear = now.year
# Changed from 6/1 to 5/1 rollover so as not to affect start of Summer HSSP registration
# - Michael P 5/24/2010
# Changed from 5/1 to 7/31 rollover to as to neither affect registration starts nor occur prior to graduation.
# Adam S 8/1/2010
#if datetime(curyear, 6, 1) > now:
if date(curyear, 7, 31) > now:
try:
# An error here can cause a good chunk of the site to break,
# so we'll just catch this if it fails and fall back on the default
d = datetime.strptime(Tag.getTag('grade_increment_date'), '%Y-%m-%d').date().replace(year=curyear)
except:
d = date(curyear, 7, 31)
if d > now:
schoolyear = curyear
else:
schoolyear = curyear + 1
Expand Down
5 changes: 5 additions & 0 deletions esp/templates/program/modules/admincore/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
{{ block.super }}
<link rel="stylesheet" href="/media/styles/forms.css" type="text/css" />
<link rel="stylesheet" href="/media/styles/expand_display.css" type="text/css" />
<style>
#id_grade_increment_date_year {
display: none;
}
</style>
{% endblock %}

{% block content %}
Expand Down

0 comments on commit bf6389a

Please sign in to comment.