TEAMMATES / teammates

This is the project website for the TEAMMATES feedback management tool for education
https://teammatesv4.appspot.com/
GNU General Public License v2.0
1.63k stars 3.26k forks source link

[#12749] Autosave and restore progress if user navigates away #13140

Open Respirayson opened 5 days ago

Respirayson commented 5 days ago

Fixes #12749

Outline of Solution

## Description This PR introduces autosave functionality for this feedback session page. The way that I implemented it ensures that users' responses are automatically saved after they have made a change. ## Some key changes #### 1. Autosave Implementation - Added autosave method + events to handle the autosaving of feedback responses to local storage - Used timeout that is started upon change in input because periodic intervals might create a potential window where the user refreshes the page before the save kicks in. And saving every input change might waste resources. So I feel that this is a best of both worlds approach to saving the data. #### 2. Loading autosaved data - Lazy loading of feedback session only when the question itself is in the viewport #### 3. Reset - Added a way for users to reset their response to the last submitted state so I like to think of it as a `git reset --hard` to help users get back to the original previous data that they had. - And I also made a few UI changes to add the buttons in to reset the data ## Video Demo Below is a video showcasing a really quick demo of what I've done: https://github.com/Respirayson/teammates/assets/88478542/5eb944dc-37b2-4925-9b49-f46c22991558 And some screenshots: Tooltip for relevant info ![image](https://github.com/Respirayson/teammates/assets/88478542/6e57d990-6b7a-40f9-aba2-f76064382469) Reset button disabled when there are no changes ![image](https://github.com/Respirayson/teammates/assets/88478542/481dd510-9a99-4784-9ee8-a9678653411c) Also updated the grouped and ungrouped questions' UI ![image](https://github.com/Respirayson/teammates/assets/88478542/7246005c-5bfb-4f55-8645-00de1f13d729)