Skip to content

Commit

Permalink
Added field for admin test notes to be shown only when editing.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Perretta committed Aug 22, 2024
1 parent 996318e commit 90f8d42
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 0 deletions.
28 changes: 28 additions & 0 deletions autograder/core/migrations/0108_internal_admin_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.2.2 on 2024-08-22 19:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0107_auto_20240806_1626'),
]

operations = [
migrations.AddField(
model_name='agtestcase',
name='internal_admin_notes',
field=models.TextField(blank=True, help_text='Additional information for admins. Shown only when editing the test case.'),
),
migrations.AddField(
model_name='agtestcommand',
name='internal_admin_notes',
field=models.TextField(blank=True, help_text='Additional information for admins. Shown only when editing the command.'),
),
migrations.AddField(
model_name='agtestsuite',
name='internal_admin_notes',
field=models.TextField(blank=True, help_text='Additional information for admins. Shown only when editing the test suite.'),
),
]
7 changes: 7 additions & 0 deletions autograder/core/models/ag_test/ag_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class Meta:
help_text='''The suite this autograder test belongs to.
This field is REQUIRED.''')

internal_admin_notes = models.TextField(
blank=True,
help_text='Additional information for admins. Shown only when editing the test case.'
)

staff_description = models.TextField(
blank=True,
help_text='Text description shown only to staff. Rendered as markdown.'
Expand Down Expand Up @@ -148,6 +153,7 @@ def delete(self, *args: Any, **kwargs: Any) -> Tuple[int, Dict[str, int]]:
'name',
'last_modified',

'internal_admin_notes',
'staff_description',
'student_description',

Expand All @@ -166,6 +172,7 @@ def delete(self, *args: Any, **kwargs: Any) -> Tuple[int, Dict[str, int]]:
'name',
'ag_test_suite',

'internal_admin_notes',
'staff_description',
'student_description',

Expand Down
7 changes: 7 additions & 0 deletions autograder/core/models/ag_test/ag_test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ class Meta:
on_delete=models.CASCADE,
help_text="""The AGTestCase that this command belongs to.""")

internal_admin_notes = models.TextField(
blank=True,
help_text='Additional information for admins. Shown only when editing the command.'
)

staff_description = models.TextField(
blank=True,
help_text='Text description shown only to staff. Rendered as markdown.'
Expand Down Expand Up @@ -425,6 +430,7 @@ def delete(self, *args: Any, **kwargs: Any) -> Tuple[int, Dict[str, int]]:
'last_modified',
'cmd',

'internal_admin_notes',
'staff_description',
'student_description',
'student_on_fail_description',
Expand Down Expand Up @@ -473,6 +479,7 @@ def delete(self, *args: Any, **kwargs: Any) -> Tuple[int, Dict[str, int]]:

'cmd',

'internal_admin_notes',
'staff_description',
'student_description',
'student_on_fail_description',
Expand Down
7 changes: 7 additions & 0 deletions autograder/core/models/ag_test/ag_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ def set_order(project: Project, order: List[int]) -> None:
have yet to be graded do not prevent members of a group from submitting
again.''')

internal_admin_notes = models.TextField(
blank=True,
help_text='Additional information for admins. Shown only when editing the test suite.'
)

staff_description = models.TextField(
blank=True,
help_text='Text description shown only to staff. Rendered as markdown.'
Expand Down Expand Up @@ -251,6 +256,7 @@ def delete(self, *args: Any, **kwargs: Any) -> Tuple[int, Dict[str, int]]:
'project',
'last_modified',

'internal_admin_notes',
'staff_description',
'student_description',

Expand Down Expand Up @@ -286,6 +292,7 @@ def delete(self, *args: Any, **kwargs: Any) -> Tuple[int, Dict[str, int]]:
EDITABLE_FIELDS = (
'name',

'internal_admin_notes',
'staff_description',
'student_description',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def test_valid_create(self):
self.assertEqual(name, ag_test.name)
self.assertEqual(self.ag_suite, ag_test.ag_test_suite)

self.assertEqual('', ag_test.internal_admin_notes)
self.assertEqual('', ag_test.staff_description)
self.assertEqual('', ag_test.student_description)

self.assertTrue(ag_test.normal_fdbk_config.visible)
self.assertTrue(ag_test.normal_fdbk_config.show_individual_commands)
self.assertTrue(ag_test.normal_fdbk_config.show_student_description)
Expand Down Expand Up @@ -180,6 +184,7 @@ def test_serialize(self):
'pk',
'name',
'last_modified',
'internal_admin_notes',
'staff_description',
'student_description',
'ag_test_suite',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def test_default_vals(self):
ag_cmd: ag_models.AGTestCommand = ag_models.AGTestCommand.objects.validate_and_create(
name=self.name, ag_test_case=self.ag_test, cmd=self.cmd)

self.assertEqual('', ag_cmd.internal_admin_notes)
self.assertEqual('', ag_cmd.staff_description)
self.assertEqual('', ag_cmd.student_description)
self.assertEqual('', ag_cmd.student_on_fail_description)

self.assertEqual(ag_models.StdinSource.none, ag_cmd.stdin_source)
self.assertEqual('', ag_cmd.stdin_text)
self.assertIsNone(ag_cmd.stdin_instructor_file)
Expand Down Expand Up @@ -505,6 +510,7 @@ def test_serialize(self):
'last_modified',
'cmd',

'internal_admin_notes',
'staff_description',
'student_description',
'student_on_fail_description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def test_valid_create_with_defaults(self):
self.assertEqual(suite_name, suite.name)
self.assertEqual(self.project, suite.project)

self.assertEqual('', suite.internal_admin_notes)
self.assertEqual('', suite.staff_description)
self.assertEqual('', suite.student_description)

self.assertCountEqual([], suite.instructor_files_needed.all())
self.assertTrue(suite.read_only_instructor_files)
self.assertCountEqual([], suite.student_files_needed.all())
Expand Down Expand Up @@ -92,6 +96,9 @@ def test_valid_create_non_defaults(self):
suite = ag_models.AGTestSuite.objects.validate_and_create(
name=name,
project=project,
internal_admin_notes='some very internal admin notes',
staff_description='an description for staff',
student_description='info for students',
instructor_files_needed=instructor_files_needed,
read_only_instructor_files=False,
student_files_needed=student_files_needed,
Expand All @@ -114,6 +121,9 @@ def test_valid_create_non_defaults(self):
suite.refresh_from_db()
self.assertEqual(name, suite.name)
self.assertEqual(project, suite.project)
self.assertEqual('some very internal admin notes', suite.internal_admin_notes)
self.assertEqual('an description for staff', suite.staff_description)
self.assertEqual('info for students', suite.student_description)
self.assertCountEqual(instructor_files_needed, suite.instructor_files_needed.all())
self.assertFalse(suite.read_only_instructor_files)
self.assertCountEqual(student_files_needed, suite.student_files_needed.all())
Expand Down Expand Up @@ -211,6 +221,7 @@ def test_serialization(self):
'project',
'last_modified',

'internal_admin_notes',
'staff_description',
'student_description',

Expand Down
48 changes: 48 additions & 0 deletions autograder/rest_api/schema/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6039,6 +6039,11 @@ components:
nullable: false
type: string
format: date-time
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the test suite.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6135,6 +6140,7 @@ components:
- name
- project
- last_modified
- internal_admin_notes
- staff_description
- student_description
- instructor_files_needed
Expand All @@ -6161,6 +6167,11 @@ components:
\ This field is REQUIRED."
nullable: false
type: string
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the test suite.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6258,6 +6269,11 @@ components:
\ This field is REQUIRED."
nullable: false
type: string
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the test suite.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6393,6 +6409,11 @@ components:
nullable: false
type: string
format: date-time
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the test case.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6436,6 +6457,7 @@ components:
- pk
- name
- last_modified
- internal_admin_notes
- staff_description
- student_description
- ag_test_suite
Expand All @@ -6459,6 +6481,11 @@ components:
\ This field is REQUIRED."
nullable: false
type: integer
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the test case.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6504,6 +6531,11 @@ components:
\ This field is REQUIRED."
nullable: false
type: integer
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the test case.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6578,6 +6610,11 @@ components:
\ default-creatable."
nullable: false
type: string
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the command.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -6788,6 +6825,7 @@ components:
- ag_test_case
- last_modified
- cmd
- internal_admin_notes
- staff_description
- student_description
- student_on_fail_description
Expand Down Expand Up @@ -6839,6 +6877,11 @@ components:
\ default-creatable."
nullable: false
type: string
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the command.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down Expand Up @@ -7065,6 +7108,11 @@ components:
\ default-creatable."
nullable: false
type: string
internal_admin_notes:
description: Additional information for admins. Shown only when editing
the command.
nullable: false
type: string
staff_description:
description: Text description shown only to staff. Rendered as markdown.
nullable: false
Expand Down

0 comments on commit 90f8d42

Please sign in to comment.