Skip to content

Overall Feedback and score bar not rendered on Question Set result page #183

@tammets

Description

@tammets

On the end/result screen of a Question Set, the Overall Feedback text (from the defined score ranges) and the score bar never appear, even when Display results is enabled and overallFeedback ranges are configured in the editor.

Affected version

H5P.QuestionSet 1.21.x (current master, observed after commit 2c3e287VA-460 Use the component library for the result screen).

Expected behaviour

When the quiz ends with Display results on, the result screen should show:

  • the computed score bar,
  • the overall feedback string matching the achieved score range (e.g. "Great job!" for 80–100%).

Actual behaviour

  • Score bar is not rendered.
  • Overall feedback text is not rendered.
  • Per-question list, header and score summary are shown correctly.

Root cause (from the code)

Before 2c3e287, the result screen template included:

<div class="feedback-section">
  <div class="feedback-scorebar"></div>
  <div class="feedback-text"></div>
</div>

After the refactor, the result screen is produced by H5P.Components.ResultScreen(...), which does not emit .feedback-section, .feedback-scorebar or .feedback-text.

However, js/questionset.js still contains the old append logic (around lines 726–745):

if (params.endGame.showResultPage) {
  if (scoreBar === undefined) {
    scoreBar = H5P.JoubelUI.createScoreBar(totals);
  }
  scoreBar.appendTo($('.feedback-scorebar', $myDom));   // matches 0 elements
  $('.feedback-text', $myDom).html(scoreString);        // matches 0 elements
  ...
}

Both selectors match nothing, so scoreString (computed via H5P.Question.determineOverallFeedback(...) at line 642) and the score bar are silently dropped.

The else branch at line 748 removing .feedback-section is also a no-op for the same reason, and css/questionset.css (lines 105–147) still styles the missing selectors.

Reproduction

  1. Create an H5P Question Set with 2+ questions.
  2. In Quiz finished / end game settings, define Overall Feedback ranges (e.g. 0–49% "Try again", 50–100% "Well done").
  3. Leave Display results enabled (default).
  4. Complete the quiz.
  5. Observe the result screen: per-question list is shown, but no score bar and no overall feedback text.

Inspecting the DOM confirms that .feedback-section, .feedback-scorebar and .feedback-text are absent from .questionset-results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions