Fivestar voting manager scale is incorrect?

Created on 26 October 2023, over 1 year ago
Updated 30 October 2023, over 1 year ago

Problem/Motivation

Unfortunately, result scale is from 20 to 100, and the module uses 1 to 5 scale (5 is also the default best rating in https://schema.org/AggregateRating), so it makes sense to use fivestar values.

Proposed resolution

Divide by 20 and round ;)

πŸ“Œ Task
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland Graber

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Graber
  • Issue was unassigned.
  • πŸ‡΅πŸ‡±Poland Graber

    On the other hand.. 20-100 is what fivestar.vote_result_manager returns so changing this should be global. May affect other implementations if done.

    Opinions needed.

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Fivestar has internally used 1-100 since the first Drupal 5 version. I'm not exactly sure why that was chosen, but it is used consistently throughout. It does help, in the current implementation, to allow sites to choose a different number of stars and to allow different fields to be configured for a different number of stars. If this variable only held integer values from 1 through 5, then how do you do 4 stars or 10 stars? Regardless, I see this as an implementation detail - you or I may not have chosen to implement it that way but it doesn't mean it's wrong.

    The bigger issue, to me, is that 0 has always been used as a special exception to represent "no votes". So there is no way to rate something as a 0, and there has to be explicit code (have to constantly check != 0) every time you do vote calculations to distinguish between a numerical vote result and "no votes".

  • Status changed to Closed: works as designed over 1 year ago
  • πŸ‡΅πŸ‡±Poland Graber

    Yes, in the end I provided best and lowest score parameters for the metadata so the scale is 20-100. I think it should be implemented like this after all even if the schema.org default is 1 to 5.

Production build 0.71.5 2024