Open-Systems-Pharmacology / MoBi

MoBi® is a software tool for multiscale physiological modeling and simulation
Other
31 stars 10 forks source link

WJ not saved when project is closed without saving #89

Open tobiasK2001 opened 7 years ago

tobiasK2001 commented 7 years ago

PK-sim project and WJ was created. New Page in WJ was created and filled with text. Nothing was done in the project however. When project is closed, user is not asked to save changes as there were none in the project. However the changes in the WJ are lost...that should not be...empty project and WJ attached WJ not saved.zip

UlrichSi commented 6 years ago

This appears to happen when two MoBi project files referring to one and the same WJ are open simultaneously. If the WJ is changed from the second project, changes will be lost. In my experience it only happens if two instances of a WJ are open, which should be avoided.

msevestre commented 6 years ago

@UlrichSi I have just tried that (two instances) and cannot reproduce the issue. The working journal is a real database underneath and can definitely handle simultaneous connection at the same time. Of course if the same entry is being edited at the same time in two different MoBi instances, the last one will win.

UlrichSi commented 6 years ago

@msevestre the behavior seems to have improved. I am not able to reproduce it either.

UlrichSi commented 6 years ago

Here is a protocol to reproduce the misbehavior:

  1. Open a project with a working journal.
  2. Rerun a simulation or a parameter identification (just to give MoBi a reason to ask if the project should be saved).
  3. Add some text to the working journal.
  4. Leave the edit window open, switch windows back to the main MoBi window.
  5. Open a different project in MoBi. MoBi will ask if it should save the project. Click on "No".
  6. Open the old project again, and look if the changes in WJ have been saved.

In the cases I tried, the WJ reproducibly lost the changes. If the WJ window is closed before I close the project in MoBi, changes are kept. @tobiasK2001 maybe you can try it this way with your projects?

msevestre commented 6 years ago

The working journal page is saved when the editor is closed (the WJ window) or when you close the project and confirm save.

In your case, you have an editor open, you close the main program (MoBi) and say NO I do not want to save. Why would you expect the open editor (WJ) to be saved?

I would almost say that the behavior is as expected....

UlrichSi commented 6 years ago

@msevestre I wouldn't agree with your last statement. Since the WJ never asks if I want to save or not but instead always does it, I would expect that I don't have to care.

The following typical workflow might illustrate how the situation described before arises:

  1. My plan is to update the WJ document of a completed project.
  2. To do this, I open project and WJ in MoBi, then copy certain parts (screenshots, parameter values, history entries) from the project to the WJ.
  3. As a consequence of step 2, like when highlighting parameter values for copying, MoBi (erroneously) assumes that the project was changed.
  4. On the other hand, I do not want to save anything that I have changed in the documentation process to the project, just to preserve its status. This is a good reason to click "No" for saving the project, but I positively want to have the WJ changes auto-saved.

In conclusion: There are ways to avoid this behavior, but one has to act very disciplined, and it is full of potential traps. If we decide to stay with the current behavior, it should clearly be well-documented.

msevestre commented 6 years ago

As a consequence of step 2, like when highlighting parameter values for copying, MoBi (erroneously) assumes that the project was changed.

Could you report a bug for that? Never heard of this behavior before.

There are ways to avoid this behavior, but one has to act very disciplined, and it is full of potential traps. If we decide to stay with the current behavior, it should clearly be well-documented.

The only thing that needs to be done is close the WJ Window when you are done editing. I think this is pretty straight forward :)

What we can implement of course is that we always SAVE The working journal when MoBi is closing, independently of project status change. That should solve your problem

UlrichSi commented 6 years ago

Could you report a bug for that? Never heard of this behavior before.

Unfortunately, this seems to be difficult to reproduce. Happens only if I copy a lot of stuff from the project to the WJ, Excel, or elsewhere. I will try to find a reproducible scenario. What definitely can happen is that something is changed by the user either by mistake, or deliberately to create a certain plot (e.g., for different doses). If one does not want to keep this change, discarding the model change(s) is straightforward.

The only thing that needs to be done is close the WJ Window when you are done editing. I think this is pretty straight forward :)

Correct - straight, but easy to forget if you use full-screen windows or have minimized the WJ window.

What we can implement of course is that we always SAVE The working journal when MoBi is closing, independently of project status change. That should solve your problem

The alternative might be that the WJ editor will also ask back if changes are discarded.