Can I show a quiz total score without showing marks in review?

Can I show a quiz total score without showing marks in review?

by Chris Herr -
Number of replies: 1

Problem: Users can only see a quiz total score/grade if the "Marks" option is enabled in the review options while the quiz is open. The "Marks" option is effectively the same as "Whether Correct". After all, if I got 1 out of 1 point on a question, then I know I got it correct. This knowledge could provide an advantage on a re-attempt compared to just an overall score (i.e. they can gauge their performance overall but not on any specific question). But, without marks being enabled we cannot provide a total score either it seems.

Is there any way to show total scores or grades without turning on "marks" under the review options? We have workarounds by using overall feedback to notify whether they have passed/failed and we allow all review options upon quiz closing, but then students have to wait to see exactly how well they did. It works, but it's not ideal, as there is no way to differentiate feedback or review options based on passing or failing that I know of.


Average of ratings: -
In reply to Chris Herr

Re: Can I show a quiz total score without showing marks in review?

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Chris,

You could write a plugin to do this, but I can't tell you how. I can only come up with a workaround with a little JavaScript code that is easy to set up but not really safe because computer-savvy students could erase the code. However, if you have students who don't know much about computers, this might be a suitable solution.

  • In the quiz settings:
    • Set "Question behaviour / How questions behave" to "Deferred feedback".
    • Under "Review options / Immediately after the attempt and / Later, while the quiz is still open", select only "The attempt" and "Marks".
    • Set "Appearance / Show more... / Show blocks during quiz attempts" to "Yes".
  • Add an HTML block to the quiz.
    • Set the "HTML block title" to a blank space (Alt-255 on a Windows computer) for discretion.
    • Put the code below in the HTML of the "Content".
    • Set "Where this block appears / Display on page types" to "Review quiz attempt page".
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $("div.grade").each(function(){
        var str = $(this).text();
        var res = str.replace(/k.*ou/,"k ou");
        $(this).text(res);
    });
});
</script>

You will get something like this: