I have a view that is set to show the number of stars as a numeral, not as the graphic of stars. Instead of showing the number of stars it is outputting the percentage...ie: 100 instead of "5".

CommentFileSizeAuthor
#6 fivestar_views_star_count.patch2.51 KBquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

riddleyw’s picture

Also, if i select (in Views2, fields options) to display the field as a percentage, it outputs the field label, but no value. Btw, works fine, if i just use the graphic.

quicksketch’s picture

Title: Views Issue » Show Number of Stars instead of Percentage in Views
Category: bug » feature

This isn't a bug, it's the way VotingAPI displays vote data. I'll move this to a feature request to make the number of stars be a display option.

Junro’s picture

subscribe :)

Flying Drupalist’s picture

Version: 6.x-1.13 » 6.x-1.15

Subscribe.

Boobaa’s picture

Subscribe.

quicksketch’s picture

Status: Active » Fixed
FileSize
2.51 KB

I added this feature with the attached patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

prabhatjn’s picture

Version: 6.x-1.15 » 7.x-2.x-dev
Status: Closed (fixed) » Active

Hi,

I am opening this issue for drupal 7. It need work there.

Thanks,
Perry.

calefilm’s picture

Issue summary: View changes

If I'm not mistaken, I believe this is an ongoing problem in D7? Here are three similar 2 Open/1 Closed threads with people having similar issues:

https://www.drupal.org/node/1440566
https://www.drupal.org/node/1113172
https://www.drupal.org/node/2040303 (#1 doesn't make any sense)

Am I wrong but if this was resolved we'd be able to close all 4 of these threads?

Anyway, I cannot seem to figure out a way to simply display the star rating as 4 instead of 80. There is no option for this? I figured it out in Drupal 6 but 7 is different.

GOAL:
Output simply displays 80... I would like the option to display 4 (as in 4 of 5)

SETTINGS A:

RELATIONSHIPS
Relationship: Vote Results
-percentage
-choose tag
-average vote

FIELDS
Field: Votes Value (Value)
choose relationship

These settings yielded same results

SETTINGS B:

RELATIONSHIPS
Relationship: Vote Results
-percentage
-choose tag
-average vote

FIELDS
Content: fivestar field
choose vote results relationship
Formatter: As stars, Rating, Percentage (Neither of which gives me the '4')

These settings yielded same results

calefilm’s picture

Here is a 'fix' to my issue: "How to show number of stars instead of percentage." I realized I could just as easily change the label of the formatter in fivestar.theme.inc, i.e. "4" instead of "4/5"

Step 1: In Views, edit your field. Set formatter to "Rating"
Step 2: Go to fivestar.theme.inc and edit line 137

Instead of $output = $rating . '/' . $stars;

I used

$output = $rating;

  • quicksketch committed 81ecee3 on 8.x-1.x
    #421800: Show Number of Stars instead of Percentage in Views.