Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag to adjust date when grades increment #3143

Merged
merged 2 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
willgearty marked this conversation as resolved.
Show resolved Hide resolved
'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