"Save changes" does not save.

"Save changes" does not save.

Dominique Bauer發表於
Number of replies: 16
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

I'm running Moodle 4.2 (Build: 20230424). When I edit a question and press the "Save changes" button, the changes are not saved. 傷心

Is this issue known?

評比平均分數: -
In reply to Dominique Bauer

Re: "Save changes" does not save.

Andrew S發表於
Is this editing in Quiz preview, or Question bank?
In reply to Andrew S

Re: "Save changes" does not save.

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片
From a main page, click on a Quiz icon then, under Quiz, click the "Preview quiz" button and then click on the "Edit question" link in one the question's "Info" block.
In reply to Dominique Bauer

Re: "Save changes" does not save.

Andrew S發表於
Ok, this may be your situation:

Your edit probably worked, but is not 'yet' displaying. With Moodle v.4.x, when you edit a question, it creates another (new) version.

So, if you edit a question within a Quiz preview, it doesn’t change the question you are looking at, but creates a newer version of that question.

You will see in the Quiz questions (in the module) that it defaults to choosing the latest question version - the drop-down box on the question says 'Always latest' (yes, this also means that you can force the Quiz module to choose a specific version of a question for that quiz).

After you have edited a question, it will still display the old version in that specific preview, because that specific version was loaded up when the preview was launched. However, when you do another preview, it will pick up the new (‘always latest’) version.

So, go through and edit your questions, finish the preview, start ANOTHER preview, and you should see the new question version(s). Or, go to Question bank and look at the source.

Does this solve the issue?

a.
評比平均分數:Useful (1)
In reply to Andrew S

Re: "Save changes" does not save.

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片
I hope so 微笑 That's what I usually do. Maybe I was tired... (If this happens again, I will document it properly, for example by making a video.)

So, go through and edit your questions, finish the preview, start ANOTHER preview, 

Just to be sure. You can "Finish attempt..." but that's not what it's about, is it? You can click on the "Back" button or on the "Start a new preview", but you cannot strictly speaking "finish a preview". You simply start a new preview on top of the previous one. Is that it?
In reply to Dominique Bauer

Re: "Save changes" does not save.

Matthias Giger發表於
Particularly helpful Moodlers的相片
You have to start a new "preview". Then you will see the updated version of your question.
評比平均分數:Useful (1)
In reply to Dominique Bauer

Re: "Save changes" does not save.

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

If you set a question to a previous version, that version is displayed in the preview and the editor, no matter what.

On the other hand, if you set it to "Always latest", this version is not displayed in the preview nor in the editor (unless you press "Start a new preview" which you shouldn't have to).

If you set a question to "Always latest", the latest version should be displayed by default whenever the question has been saved.

I hope I don't offend anyone by saying that things look confusing to me as they are, and that in my opinion there is no advantage in not showing the latest version of a question by default if it is set as such.

MoodleForum_20230619_1532.png

In reply to Dominique Bauer

Re: "Save changes" does not save.

Andrew S發表於
I get what you are saying and, when I first came across this, I went through the logic of it in my head and wondering similar; but, in the end, it made the most sense when I considered how the preview also behaves with random questions.

When the preview is launched, it loads up the specific questions to the Quiz view for that user. This also includes any randomised questions, such as 4 questions in the Quiz drawn from from one category of 9 questions.

The randomised questions in the 'one' quiz instance rely on rules, such as the same question not being repeated. If, every time you refreshed or went back in the browser the question changed, the preview would not be replicating what a user/student experiences and the randomisation rules would likely need refreshing/changing more than that one question.

I guess someone 'could' add a "refresh whole preview" function; but, for now, there is a logic to the questions (random allocation from category, version number, etc.) being fixed within one preview.
In reply to Dominique Bauer

Re: "Save changes" does not save.

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

@TimHunt or a developer of the question bank,

Thanks to Andrew for bringing up the random question topic.

The situation is even worse with random questions. A given question is updated only when you press the "Start a new preview" button, but since the questions are random, the question may disappear in the new preview without you being able to see the result of the change to the question.

I would prefer not to argue with Andrew here, but simply draw a developer's attention to the lack of logic in how the "Always latest" setting is applied to the question editor and preview, i.e. the fact that it would be much better to just show the latest version of a question when it's set that way.

In reply to Dominique Bauer

Re: "Save changes" does not save.

Andrew S發表於
Well, I certainly wasn't arguing for a point, just stating how it currently worked. When I said 'there is a logic', I meant that I can see 'how/why' it works that way. I wasn't advocating that it was the best way.

Apologies if it was taken otherwise.
a.
In reply to Dominique Bauer

Re: "Save changes" does not save.

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

As more people upgrade to Moodle 4.x, and start interacting with the question versionning featue, we are learning more about where the unsability problems are. (Thanks to everyone who has shared their experiences here.)

And, as we identify problems, we are gradually working on improving things. For example MDL-75301 was an improvement related to question preview. This is what you see in question preview now.

MDL-75301.png" alt="New question preview UI." class="img-fluid atto_image_button_text-bottom" width="448" height="370">

In the case of quiz preview, which is what we are discussing here, Andrew and Matthias have analysed the problem, and the 'answer' is that you have to start a new preview. But, that is not obivous. MDL-77745 is being worked on right now, which should help to make it clearer what is going on. Here is the mock-up of what that might look like when it is done:

I am not saying that is a total solution. Just a step in the right direction.

So, please keep reporting what is not yet easy enough to work with, and we will keep listening, and improving things as we can.

In reply to Tim Hunt

Re: "Save changes" does not save.

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

Thank you for considering user feedback.

In Moodle 3.x, it was already a bit not obvious to have to click "Start a new preview" after editing a question. Indeed, if we edited a question, why would we have wanted to preview the unedited version? But at least when saving the question, the latest version (since there was only one) was displayed in the editor.

Now with version 4.x, it is still not obvious, I would even say a little awkward, to have to click "Start a new preview" after having edited a question. The reason is the same, why would one want to preview the unedited version of a question? But worse, if you don't click "Start a new preview", the editor doesn't display the latest version of the question. This is really not obvious.

I think it would be good to update the preview as soon as you press the "Save changes" or "Save changes and continue editing" buttons in the editor. In fact, this is what is done when editing a question via "Questions" in the main menu of a quiz.

May I suggest that the following behaviour should be added to the random question algorithm, i.e. provide the same questions. Call it "fixed random behaviour". When "Save changes" is clicked in the editor, the "fixed random behaviour" would be triggered. If you then press "Start a new preview", the regular algorithm would be triggered.

評比平均分數:Useful (1)
In reply to Dominique Bauer

Re: "Save changes" does not save.

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Well, I would like to think that I alwasy 'consider' user feedback. Unfortunately I don't always have time to do anything about teh feedback, which is probably frustrating for all concerned.

I think that something like what you suggest is probably the way to go. It might be techncially difficult to update the previews when the question is edited, but we might be able to get the same effect by updating the preview, just before (re-)displaying it to the teacher, if necessary. We achieved implemented something similar with the embed question filter. (https://github.com/moodleou/moodle-filter_embedquestion/blob/latest/showquestion.php#L105 and https://github.com/moodleou/moodle-filter_embedquestion/blob/latest/classes/attempt.php#L492.) - embedded question was easier, because we we only have to handle one question at a time, not a whole quiz attempt.

(Oh! and this prompts me to notice that I have not yet published the latest embed question changes to the plugins DB 傷心 Another thing for me todo list.)
In reply to Dominique Bauer

Re: "Save changes" does not save.

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

I like to go through "Quiz / Preview quiz" (or "Quiz / Continue the last preview" to edit one or the other of the quiz questions because I have, in the preview, an overview of the questions as they appear in the quiz.

Assuming we're talking about the same thing, I think it would be handy to ... [automatically] update the preview when the question is edited.... I am convinced that this could be technically difficult to do.

However, a temporary workaround, which can be easily implemented even by teachers, is to add a little client-side JavaScript code. The logic is simple:

  1. While in the editor, set the value of a session-storage element when the "Save Change" button is clicked.
  2. While in the previewer, get the value of the session-storage element, trigger the "Start a new preview" button and reset the session-storage element.

This code only contains about 10 lines. It can be placed for example by a teacher at the level of a quiz, or at the level of a course therefore for all the quizzes of the course, or by an administrator at the level of a site for all the quizzes in all the courses of the site.

The code uses jQuery. Since this is a temporary patch, it shouldn't be too much of a problem. In my opinion, the code is generally safe. But if you're not comfortable with jQuery, at worst just don't use this workaround.

    // WHILE ON THE QUESTION EDIT PAGE:
    if ( window.location.href.indexOf("question/bank/editquestion/question.php") > -1 && window.location.href.indexOf("attempt.php") > -1) {
        // ON CLICKING THE SAVE BUTTON, 
        // SET A SESSION STORAGE KEY, questionsaved, TO "yes".
        $("input#id_submitbutton").on("click", function(){
            sessionStorage.setItem("questionsaved", "yes");
        });
    }
    // WHILE ON THE PREVIEW PAGE:
    if ( window.location.href.indexOf("mod/quiz/attempt.php") > -1 ) {
        // RETREIVE THE VALUE OF THE questionsaved SESSION STORAGE KEY.
        var dcquestionsaved = sessionStorage.getItem("questionsaved");
        // IF THE VALUE OF THE questionsaved SESSION STORAGE KEY IS EQUAL TO "yes",
        // TRIGGER THE "Start a new preview" BUTTON AND RESET THE VALUE OF THE questionsaved KEY.
        if( dcquestionsaved == "yes" ){
            $("#mod_quiz_navblock button[type=submit]").trigger("click");
            sessionStorage.setItem("questionsaved", "reset");
        }
    }
In reply to Dominique Bauer

Re: "Save changes" does not save.

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I have created MDL-78547 to capture the need for a proper solution for this. I hope the description I wrote there is a good summary of the problem, and possible solutions.
評比平均分數:Useful (1)
In reply to Tim Hunt

Re: "Save changes" does not save.

Rick Jerz發表於
Particularly helpful Moodlers的相片 Testers的相片
I voted for this and added some comments in Tracker. I might have added another problem. Let me know if you need me to create a separate Tracker item for it.
 
Wow, that "versioning" feature that was added for questions might have some powerful new features, but it also has been creating some headaches.  I think that it might take a little time to discover all these little problems that were missed during the new programming.  
評比平均分數:Useful (1)