Grading view improvements
I propose the following improvements:
-
Move the navigation into it's own component -
Move definitions for SuggestionKeys,RenderSelected and RenderSuggestion into the SearchBox Componenent, or create a StudentSearchBox componenent that wraps it. We use basically duplicate our functions in all 3 usages of the searchbox now. -
Rename submission.id to submission.copy everywere (take care when doing this, also with currently open MR's) -
Limit the state knowledge of the Grade page, and use the server more as a source of truth. The grade page needs: - the examID - the graderID - the current submission - the current problem - a list of submissionIDs - a list of submissionIDs that are graded - a list of problemIDs - a function to update the current view. This would take (submissionID, problemID) and update all properties based on that, so that it can update exactly what it needs, and not too much. (This would include stuff that is not currently updated properly: the progress and the feedback options)
There are two ways to implement this:
- Give the Grade component the entire exam as prop, and calculate what is needed every time. The Grade component would make the necessary requests itself, and update when it needs to.
- Give the Grade component only accessors (in App.jsx) to the items in the list above, use them in the Grade component. In this way, the grading page is forced to use the API on every call. For example, when getting the list of graded submission, the accessor will request this list from the server instead of using what's locally available.
I prefer the 2nd option in terms of encapsulation. However, I feel the first option might be simpler, however, we should then take to not use the information (that we have in the exam object) when we shouldn't.
EDIT:
-
There is something to be said for creating a GradeContext using the context API. However, there aren't really that many nested components, so I don't think it's that useful here. It is worth looking in to though. -
Only update all submissions when switching submission, not when toggling a feedback option.