This repository was archived by the owner on Mar 2, 2019. It is now read-only.
Open
Conversation
…/source-academy2 into versioningBackend
… VersionHistory on the frontend
Specifications: Local Version Recovery This enhancement aims to curb the issue of lost data due to accidental closing of the tab or browser while editing. The app should use the client's browser's local persistent memory to keep track of what the user has in his code editor. In the case of an accident where the user forgets to save his work or closes his tab, when the browser returns to the page, the app will prompt the user that he has not saved his work before he left the page and display the locally saved version and the cloud-saved version side-by-side with a helpful visual diff. This is done by comparing the timestamps between the locally saved version and the cloud-saved version. It will only prompt the user in the case where the locally saved version has a later timestamp than the one on the server, signalling that something might have went wrong on the client-side. It will also allow the user to view both the current version tagged to his account and the local version on his browser so that the user can decide which one he wants to use. Save History This enhancement aims to allow users to return to previously saved versions of their code by keeping a history of their saved versions on the server. On the user's end, no additional action is required when saving his code. On the server side, the server will enqueue the newly saved version into a version history queue. This queue should have a fixed maximum size (10) so that we do not run into memory issues on the server. If the user saves when he already has 10 version histories, the earliest version history is deleted to make way for the new version. The user should be able to access any of the last 10 versions by accessing a dropdown menu on the coding page. Implementation: Local Version Recovery We utilized the browser's localStorage, storing all changes and the time at which it was saved locally. Also, wereturned an additional savedAt field when retrieving the user's progress on the workspace page. We will then check the difference in timestamps to determine if the user should be aware that he has a local version that is saved later than the one on the cloud, in the case that he wants to use it. This is done in the form of a modal popup, allowing the user to see the differences in the saved versions. Save History We added a new table in the database to allow us to save a user's past versions. We also ensure that there is a maximum of 10 user histories per assignment question in the database. The frontend then uses the returned JSON data to populate a new side content tab with the user's version histories. Also, the user is able to preview the past version histories by hovering over the boxes.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.