First of all, thanks for the great module. I am using fivestar for voting and am wondering if there is a way to make it so a '5 star' vote counts as '2', a '1 star' vote counts as '-2', etc.

Right now it seems to count every star rating as a "vote up".

Thanks.

Comments

skiminki’s picture

It does vote ups because fivestar gives always positive vote values (if I remember correctly). However, I'm not outrightly convinced of your use case, maybe regular voting suits better? Or do you really want to reach for content that has been recently (and only recently) mostly hated (1 stars) or loved (5 stars)? Averagely voted content would have around 0 energy and wouldn't really show up.

Anyways, Vote Up/Down should work with Radioactivity and has a solid use case with Drigg.

skiminki’s picture

Version: 5.x-1.3-rc1 » 5.x-1.x-dev
skiminki’s picture

Category: support » feature
jmunning’s picture

Thanks for the response. I would be happy with different energy values for different ratings but as of now every vote counts as a "thumbs up" regardless of if it is a 1 or 5 star.

greggles’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

I'm thinking about how we should do this in a way that is generalized for all voting modules knowing that they can provide positive/negative numbers or positive numbers from X to Y.

One solution is to provide additional sub-modules for radioactivity which work with specific voting modules so that we have a fivestar module in addition to the votingapi module.

An alternate solution here is to multiply the energy by the vote value for votingapi, though that gives a positive number * energy in the case of a 1 star vote while I think it makes more sense for a 1 star vote to decrease the energy.

I need a solution for fivestar (and will be working on it this week) so any advice on what you prefer will help me.

greggles’s picture

Title: Way to use radioactivity with Fivestar? » Provide Fivestar specific integration for Radioactivity module
Status: Active » Needs review
StatusFileSize
new1.09 KB

Attached is tar.gz file which should be opened into the plugins directory and can then be enabled in the admin interface. This module provides separate energy ratings for 1 through 5. So, I've set it up to decrease the energy by 5 units if there is a vote of 1 star and decrease energy by 2 if there is a vote of 2 stars, increase energy by 1 for 3 stars, etc.

As I mentioned in my last comment, this is a fairly naive implementation because it provides a fixed number of options at five when in fact there may be 2 stars or 10 stars in a particular site configuration. I think this works well enough for 90% of the sites out there and should be included/committed even though it doesn't work "perfectly.

greggles’s picture

Assigned: Unassigned » greggles
greggles’s picture

StatusFileSize
new1.07 KB

This updated version removes an unnecessary watchdog debug message and fixes a fatal error from some .install file functions which I forgot to rename.

skiminki’s picture

I looked very briefly your implementation and it looks ok. I'll review and test it later and probably include it in the next release.

However, a more general approach would be welcome, but as votingapi doesn't really define what values votes should have and different voting plugins use different scales, this becomes problematic. We could define two (vote value, given energy)-points in profile and then interpolate/extrapolate energy using vote value. Or we could allow people to write some custom PHP code that do the translation. However, I wouldn't consider these very easy to use. Given that radioactivity plugins should be very easy to write, it's probably better to write custom modules for weird use cases.

Anyways, thanks for contribution.

greggles’s picture

You're very welcome.

I tried to think about how to do this more cleanly/generically - I created #688798: provide information about the widget to votingapi_set_votes so hook_votingapi_insert has more info to discuss some of the problems but I'm not sure there is a good solution.

skiminki’s picture

Status: Needs review » Fixed

Tested and committed the module from comment #8 above with the following changes:

  • Removed Fivestar comment energy support. AFAICT, Fivestar does not actually support comment rating, but instead, node rating in conjunction with commenting.
  • Small help text changes in drupal on-line help and module description in .info
  • Small comment fix almost not even worth mentioning (up/down -> fivestar in .module description comment)

Please correct me (with a small how-to) if I was wrong about Fivestar comment rating.

greggles’s picture

I think this looks perfect. Thanks for the review, fixes, and commit!

Status: Fixed » Closed (fixed)

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