mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-20 17:50:16 -04:00
feat(profile): prevent deferrals of RD and rolling admissions
Those are impossible AFAIK
This commit is contained in:
parent
ec8834ef83
commit
16f503edb8
|
@ -72,6 +72,11 @@ class DecisionForm(forms.ModelForm):
|
||||||
):
|
):
|
||||||
raise ValidationError("You cannot add a second entry for this college")
|
raise ValidationError("You cannot add a second entry for this college")
|
||||||
|
|
||||||
|
# Rolling and RD decisions cannot be deferred
|
||||||
|
if cleaned_data.get("decision_type") in [Decision.REGULAR_DECISION, Decision.ROLLING]:
|
||||||
|
if "DEFER" in cleaned_data.get("admission_status"):
|
||||||
|
raise ValidationError("Regular Decision and Rolling decisions cannot result in a deferral")
|
||||||
|
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -426,6 +426,30 @@ class ProfileTest(TJDestsTestCase):
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
self.assertEqual(1, Decision.objects.filter(college=college, user=user).count())
|
self.assertEqual(1, Decision.objects.filter(college=college, user=user).count())
|
||||||
|
|
||||||
|
# No deferrals for RD and rolling
|
||||||
|
Decision.objects.all().delete()
|
||||||
|
response = self.client.post(
|
||||||
|
reverse("profile:decision_add"),
|
||||||
|
data={
|
||||||
|
"college": college.id,
|
||||||
|
"decision_type": "RD",
|
||||||
|
"admission_status": "DEFER_WAITLIST_ADMIT",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertEqual(200, response.status_code)
|
||||||
|
self.assertEqual(0, Decision.objects.filter(college=college, user=user).count())
|
||||||
|
|
||||||
|
response = self.client.post(
|
||||||
|
reverse("profile:decision_add"),
|
||||||
|
data={
|
||||||
|
"college": college.id,
|
||||||
|
"decision_type": "RD",
|
||||||
|
"admission_status": "WAITLIST",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertEqual(302, response.status_code)
|
||||||
|
self.assertEqual(1, Decision.objects.filter(college=college, user=user, admission_status=Decision.WAITLIST).count())
|
||||||
|
|
||||||
def test_decision_update(self):
|
def test_decision_update(self):
|
||||||
user = self.login(make_senior=True, make_student=True, accept_tos=True)
|
user = self.login(make_senior=True, make_student=True, accept_tos=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user