feat: add GPA view, editing, tests

This commit is contained in:
Shreyas Mayya 2021-09-16 09:48:37 -04:00 committed by Ethan Nguyen
parent 6eb0a331ed
commit 46120a18f3
3 changed files with 9 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class ProfilePublishForm(forms.ModelForm):
class Meta:
model = User
fields = ["publish_data", "biography", "attending_decision"]
fields = ["publish_data", "GPA", "biography", "attending_decision"]
help_texts = {
"biography": "ECs, intended major, advice, etc.",

View File

@ -34,6 +34,7 @@ class ProfileTest(TJDestsTestCase):
response = self.client.post(
reverse("profile:index"),
data={
"GPA": 4.000,
"biography": "hello",
"attending_decision": "",
"publish_data": False,
@ -43,6 +44,7 @@ class ProfileTest(TJDestsTestCase):
self.assertEqual(
1,
User.objects.filter(
GPA=4.000,
id=user.id,
biography="hello",
attending_decision=None,
@ -59,6 +61,7 @@ class ProfileTest(TJDestsTestCase):
response = self.client.post(
reverse("profile:index"),
data={
"GPA": 3.141,
"biography": "hello2",
"attending_decision": decision.id,
"publish_data": True,
@ -69,6 +72,7 @@ class ProfileTest(TJDestsTestCase):
1,
User.objects.filter(
id=user.id,
GPA=3.141,
biography="hello2",
attending_decision=decision,
publish_data=True,
@ -88,6 +92,7 @@ class ProfileTest(TJDestsTestCase):
response = self.client.post(
reverse("profile:index"),
data={
"GPA": 1.234,
"biography": "hello2",
"attending_decision": decision2.id,
"publish_data": True,
@ -98,6 +103,7 @@ class ProfileTest(TJDestsTestCase):
1,
User.objects.filter(
id=user.id,
GPA=1.234,
biography="hello2",
attending_decision=decision,
publish_data=True,

View File

@ -38,6 +38,7 @@
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">GPA</th>
<th scope="col">Test scores</th>
<th scope="col">Biography</th>
<th scope="col">Decisions</th>
@ -47,6 +48,7 @@
{% for senior in object_list %}
<tr>
<td>{{ senior }}</td>
<td>{{ senior.GPA|stringformat:".3f" }}</td>
<td>
{# Test scores #}
<table class="table table-sm">