frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Implement isGradingPublished (plus related features)

Open josh1248 opened this issue 11 months ago • 3 comments

Description

Paired with backend request https://github.com/source-academy/backend/pull/965

Closes #746 Closes #799 Closes #2189 Mitigates #2522 (reduces but does not eliminate issue of graded, resubmitted work outright) Affects #738 ('not_attempted' is now ranked below attempted/submitted categories - late submitters will have to be placed under the 'submitted' category to allow publishing) Supersedes #2546

  • Introduces isPublished as specified on #2522 into the gradings page, but with modifications to support autograded submissions
  • Introduces publishAll and unpublishAll in GroundControl (admins only), allowing for batch publishing
  • Introduces isAutoPublished that permits autograded submissions to be automatically published by the autograder
  • Revamp of frontend-derived "gradingStatus" to "progress" that incorporates new isPublished field and removes isManuallyGraded from consideration
  • Tweak notifications to reflect published and unpublished actions instead of graded / ungraded actions

Introduce isPublished

This pull request implements the isPublished feature as described on #2522, but in a modified manner.

The original intention of a 'published' field was to help avengers receive resubmitted work by students properly without having it be buried within other assessments marked 'graded'. It also helps to hide uncompleted grading by the avengers from the student. To mitigate this issue, this pull request has adjusted the frontend categorization to include isPublished. Therefore, finalized (published) assignments are marked as 'Published', which is separate from the 'Graded' category. Avengers will thus have an easier time finding resubmitted work by students in 'Graded' , albeit under a category that is still quite misleading (see flow chart in 4th section below for more).

This pull request also additionally implements isPublished for autograded assessments - autograded assessments must now be manually published. This is to account for cases when autograder results being immediately visible to students may not be desirable, such as in PEs.

To accomplish this, the frontend will now use the newly provided 'isGradingPublished' field from the backend to determine if grading is to be shown to students. Unpublished assessments, even if fully graded, will not be shown to students.

image

^New interface for grading submissions showing implementation of isGradingPublished, plus additional actions to be further pointed out.

image

^Even though mission has been fully graded, student sees "grading in progress.". addresses #799.

  • Graders must now publish their graded submissions (under 'Actions') before their grading becomes visible to the student.
  • Graders cannot publish if submission is not fully graded.
  • Graders cannot unsubmit submissions if published. They must unpublish first.
  • Graders may click on 'Progress' to filter it, just as they can for other categories.
  • Additionally, the dropdown options have been adjusted from Viewing ungraded/all to Viewing unpublished/all. This is to prevent graded but unpublished assessments from being hidden.
  • Aside: minor improvements to existing logic - graders cannot re-autograde or unsubmit submissions that are not submitted.

publishAll, unpublishAll

To prevent the need for manual publishing of many submissions under the same assessment, a publishAll and unpublishAll control status has been added to the admin-only ground control to allow for bulk publishing / unpublishing. It is mapped to backend processes for atomicity and logic checking (like ensuring that submissions that are not graded are ignored when 'publish all' is triggered.)

image

^new field added to controls, 'Release Grading', with unpublish and publish all buttons added in the category (in that order)

image

^prompt when 'unpublish all' button is clicked

image

^prompt when 'publish all' button is clicked - checks are done in the backend to prevent publishing of non-graded work

isAutoPublished

To prevent submissions for trivial autograded assessments like Paths from clogging up grading submissions tracking, a new backend field, 'isAutoPublished', has been added to each type of assessment, controllable within the admin panel. This field permits the autograder to publish on behalf of the avenger one it has fully graded the work. This field can only be set to true for assessments that are not manually graded.

image

^new toggle, is Auto-published, has been introduced.

image

^toggling isAutoPublished to true will trigger isManuallyGraded to false (similarly for isManuallyGraded toggle).

Revamp derived frontend field

With the introduction of publishing for submissions, the frontend-derived gradingStatus field can now be revamped and combined into a single comprehensive 'progress' state.

image

^ new comprehensive 'progress' status that boils down multiple backend fields into a single frontend field - all possible states, except the mystical 'not attempted' flag, are present.

image

^old control flow - credit to PR description in #2522

image

^new control flow

The new 'computeProgress' function computes the frontend-only progress field as such:

status is fully graded? is published? progress
not_attempted ? ? not_attempted
attempting ? ? attempting
attempted ? ? attempted
submitted no ? submitted
submitted yes no graded
submitted yes yes published

this derivation is done in a way that maintains backend pagination as we can deduce a unique combination of backend parameters to filter by from this progress status. it additionally avoids the need to bring up gradingStatus when the student has yet to submit their work, hence addressing #746.

Notification message change

image

^Old notifications show "autograded" notification even when not yet published.

image

^New notifications do not show any notification until published.

The notifications for autograded assessments that are not automatically published has become misleading because of our change - autograded submissions immediately trigger a notification even when not yet published. Thus, the frontend has been tweaked in accordance to the notification type changes in https://github.com/source-academy/backend/pull/965 so that only published and unpublished notifications are given.

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [X] Breaking change (fix or feature that would cause existing functionality to not work as expected)

This pull request is a breaking change as it expects multiple additional non-optional fields introduced in https://github.com/source-academy/backend/pull/965.

  • For submissions, it expects a new field in the response, "isGradingPublished".

  • 'Publish' and 'Unpublish' buttons for submissions grading are coupled to new paths in the backend to change this field.

  • ditto for publishAll / unpublishAll controls in GroundControl and isAutoPublished in AdminPanel.

  • For the notification system, the current notification types "graded" and "ungraded" are no longer accepted by the frontend ("deadline" is also removed as it appears to be not in use), and will be marked as "unknown notification". In replacement, the new types "unpublished" and "published" will be expected instead.

  • [X] This change requires a documentation update

This pull request can serve as temporary documentation

  • [X] Code quality improvements

Minor changes to existing code that happened to be convenient to implement:

  • Minor improvements to submissions actions logic.

  • Simplifies frontend-derived gradingStatus to the progress field

  • Minor type safety improvement

Checklist

  • [X] I have tested this code
  • [ ] I have updated the documentation

Known issue

image

The dashboard that monitors grading progress of avengers has also become misleading, as it simply checks for graded assignments (that may not be published). It will be more accurate for this to instead (or additionally) indicate the number of published submissions so that the dashboard can properly reflect the feedback that can be received by students. To prevent this PR from getting any bigger, this has been shifted as a future issue to be addressed under the paired issues https://github.com/source-academy/frontend/issues/2898 and https://github.com/source-academy/backend/issues/1099.

josh1248 avatar Mar 19 '24 20:03 josh1248