Draft
Conversation
…us is the same as version history save status.
…e submission to save code to backend
…imestamp)-restored"
…s showing saved even on fail
…g in team assessments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements versioning and history for the editor in coding assignments, such as missions, quests, and paths. Currently there is no versioning, and the editor only saves and submits the latest version to the server.
This change aims to:
allow students to review or edit previous versions of their code
allow TA’s to understand their student’s coding process to better guide them
allow admins to check for suspicious coding patterns (copy pasting from AI or plagiarism)
Features:
Control Bar Changes:
The original save button has been removed, as the code is now autosaved with a 3 second debounce.
A new saving indicator shows the status of the code, between saving, saved, and saving failed. Whenever unsaved changes are detected, the indicator will show “Saving” and once the debounce expires and the code is saved, it shows “Saved” or “Saving failed” based on the response from the backend.
A new history button opens up the version history view explained below.
Note: The save button is NOT removed for team assessments as every save will override teammate’s code as well, so we keep the manual save. The saving indicator is removed, but the history button remains, as the version history viewing and restoring still works using manually submitted versions.
Versions are stored in a linear fashion ordered and named by default by timestamp:
Timestamp 2 ← Current Version
Timestamp 1
When a previous version is restored, it is simply saved as a new version on top of the previous versions:
Timestamp 1 - restored ← Current Version
Timestamp 2
Timestamp 1
When the history button is clicked, a drawer opens up on the right of the screen, showing the versions and a preview of that version’s code. The student can restore a version by clicking the “Restore this version” button after selecting and previewing that version.
Students can rename the versions by clicking on the default timestamp name. A separate timestamp will still remain below the name.
Video.1.mov
Possible improvements:
Saving deltas for small changes and snapshots for major changes.
Only display snapshots for major changes when opening the version history panel, and show the versions saved as deltas as a drop down if detailed versions are requested by the user.
Type of change
How to test
Added tests to WorkspaceSaga.test.ts, WorkspaceReducer.test.ts, and WorkspaceActions.test.ts to test changes.
Manually tested coding in the editor to see if functionality is as expected
Steps taken:
Continuously typed to ensure debounce works
Stop typing to check if debounce runs out and code is submitted and saved
Check version history panel to see if all versions are displayed correctly
Rename a version and check if change is saved correctly
Restore a version and check if code is restored, submitted and renamed correctly
Edited code but made no changes to ensure duplicates are not saved as a new version
Refresh the page to check if the initial population of the editor causes an unwanted extra save
Checklist