Problem/Motivation

On the "Node Votes" tab (/node/{node}/node-rating), the per-option results table (Option / Count / Sum) always shows 0 for every option when the widget uses the fivestar template, even though votes exist. The front-end rating (average) is correct; only this admin results table is wrong.

Steps to reproduce

  1. Add a rate widget using the fivestar template to a content type.
  2. Cast several fivestar votes on a node (e.g. a few 4s and 5s).
  3. Visit /node/{node}/node-rating.
  4. Every option (1–5) shows Count 0 and Sum 0.00, instead of the real per-option totals.

Proposed resolution

In WidgetResultsController::nodeResults() the vote type passed to getVotes() is hard-coded to 'updown':

$values_count = $this->rateWidgetBase->getVotes(..., 'updown', ...);
$values_sum   = $this->rateWidgetBase->getVotes(..., 'updown', ...);

Fivestar votes are stored with the fivestar vote type, so querying updown returns nothing and every option shows 0. Everywhere else the module derives the vote type from the widget template (see RateHooks and RateWidgetField):

$vote_type = ($widget_template == 'fivestar') ? 'fivestar' : 'updown';

Apply the same logic in the controller. Non-fivestar widgets keep updown (unchanged); fivestar widgets are fixed.

Remaining tasks

  • Review the merge request / patch.
  • Confirm no regression for updown and other non-fivestar widget templates.

User interface changes

The per-option Count/Sum table on the Node Votes tab now shows the correct per-option totals for fivestar widgets (previously always 0). No other markup changes.

API changes

None.

Data model changes

None.

Issue fork rate-3621702

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ricardofaria created an issue. See original summary.

ricardofaria’s picture

Status: Active » Needs review