Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic save issue with concurrent edition of the same exercise #316

Closed
erikmd opened this issue Sep 23, 2019 · 0 comments · Fixed by #372
Closed

automatic save issue with concurrent edition of the same exercise #316

erikmd opened this issue Sep 23, 2019 · 0 comments · Fixed by #372
Assignees

Comments

@erikmd
Copy link
Member

erikmd commented Sep 23, 2019

Kind: bug
learn-ocaml version: 0.11

Context

The latest release of learn-ocaml uses some automatic save of the exercise as soon as the window is closed.

On the one hand, it is not very "intuitive" because the operation is precisely performed transparently for the user (so several students told me this afternoon that they were not sure whether and when their exercise was saved…)

On the other hand, I've noticed the issue below (which we had also noticed and fixed in learn-ocaml-editor (so I guess I could propose a similar PR to adddress this when I'll have some time))

Steps to reproduce the bug

  1. we open in two different tabs or windows of the browser, two views of learn-ocaml with the same user and the same exercise, say, Tab A and Tab B [this can be be useful e.g. if one has a dual screen, namely a laptop screen and an additional monitor].
  2. we slightly modify Tab B (without clicking on "Sync" nor "Grade").
  3. we thoroughly edit Tab A (say, with several additional lines) and click on "Sync".
  4. we close Tab A, then Tab B (without clicking on "Sync").
  5. we reopen the same URL of the exercise.

Actual result

  • The version of Tab B shows up.

Expected result

  • when closing Tab B at step 4., a standard dialog is displayed, and asks whether to exit without saving the changes; we choose "no" on purpose.
  • after step 5, the version of Tab A shows up.
@erikmd erikmd added this to the learn-ocaml 0.14.0 milestone Oct 5, 2021
erikmd added a commit that referenced this issue Mar 5, 2022
* Mechanism 1:
  We disable the automatic and implicit saving of the student answer when the browser tab is closed. Instead, we ask the user to confirm that she wants to leave the page (unless the answer has already been synchronized).
  Related: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#example

* Mechanism 2:
  When an answer has not been modified for 3 minutes, we check (upon next keystroke) if a more recent solution exists on the server. In that case, we ask the user if she/he wants to download the most recent version.

* Mechanism 3:
  To avoid overloading the server with many synchronization requests, we disable the synchronization button when the answer is synchronized, and reactive it only when a modification is made on the answer.

Close #316
Fix #467

Co-authored-by: Yann Regis-Gianas <yann@regis-gianas.org>
Co-authored-by: Erik Martin-Dorel <erik.martin-dorel@irit.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants