Negative amount and integration with Drigg
cedricfontaine - August 27, 2008 - 20:11
| Project: | Radioactivity |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Hello,
I'm adding radioactivity support in Drigg, in order to offer a way to promote scoops using votes and radioactivity.
I have two questions :
* Could I add a plugin to have energy depending on the vote value (+ or -) ? And is there any documentation about plugins ?
* Could I set a negative energy for negative vote ?

#1
1) You can add a plugin depending on vote value. Use e.g. sources "vote_up", "vote_down". Unfortunately, there is currently no documentation on plugins, but you could use radioactivity_votingapi-plugin as a basis (~40 lines of code). The important function there is <module>_radioactivity_info(). You'd probably want something like
return array('sources' => array('node' =>array('vote_up' => array('title_placeholder' => 'vote up'), 'vote_down' => array('title_placeholder' => 'vote down')),
'comment' =>
array('vote_up' => array('title_placeholder' => 'vote up'), 'vote_down' => array('title_placeholder' => 'vote down'))));
This declares sources vote_up and vote_down for both nodes and comments. In effect, you can set energy values for those in radioactivity admin.
2) You can set negative energy for negative vote. However, currently the energy for a node will not go below 0. This is something we might need to change in a future revision of radioactivity.
#2
Could you add this to the votingapi plugin then ?
#3
I'm going to look into this shortly. Currently, radioactivity_votingapi provides most voted metrics, but what you're suggesting is radioactive voting. I wonder if these two should be different modules?
#4
Committed: http://drupal.org/cvs?commit=136722
Implemented new
radioactivity_up_down_votingmodule based on cedricfontaine's patch. This module differs fromradioactivity_votingapiby that you can set different values for vote up and vote down.cedricfontaine: Could you please test this and mark this issue as 'fixed' if it works for you?
#5
This does not work for me at all. It seems that it doesn't trigger when voting ? Did I miss something ?
#6
Ok, renaming the module broke the votingapi insert because
radioactivity_votingapiused actually wrong callback for votingapi, which just happened to work by accident. Fixedradioactivity_votingapiandradioactivity_up_down_votingin http://drupal.org/cvs?commit=138546 and this time I actually made the effort to test it myself before committing. Never skip testing even the most obvious change... my bad.So, let's try this again, ok? You can download the fixed
radioactivity_up_down_votingmodule directly from CVS via this link:http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/radioactivi...
If this doesn't work for some reason, please tell the following:
votingapiversion#7
#8
Automatically closed -- issue fixed for two weeks with no activity.
#9
What's the story with this?
What I mean is that I'm using this module with Drigg. And my Drigg is set up to let people vote a node up or down.
Ok.
So when they vote up, I want it to add 5 energy points to the node. When they vote down, I want it to subtract 5 points.
1. I created a decay profile.
2. In the decay profile, I've got a place to enter in energy settings for the Drigg type node.
3. I've got 6 slots: Energy from node view - Energy from submitted comment - Energy from published comment - Energy from vote up - Energy from vote down - Energy from vote
What do I put in the last three slots to get this to work? Does a negative number in vote down subtract energy from a node? A positive number? Do I leave the last slot empty?
Thanks. I just want to understand how this works.
#10
Energy from vote adds energy per any vote. This is used for most voted rankings and the use case there is a bit different. For Drigg-style voting (as described above), you'd use only energy from vote up and vote down, and ignore the last (Energy from vote).
I think I need to start compiling FAQ for this module ;)
#11
skiminki. Thanks for clearing up the Vote field mystery.
What goes in the vote down field? -5? 5? Something else?
#12
That's something you may need to experiment with. Vote up = +5 and vote down = -5 could be a good starting point. See how it goes and whether that produces the results you like. Probably it does. I think that was the initial idea behind this feature, anyway. BTW, it shouldn't really matter if you use +5/-5 or +1/-1 or something like that, it's only about proportions, as long as the values are a somewhat higher than the cut-off energy.
You could also try:
This said, I should probably confess that I don't use up/down voting and before cedricfontaine's initial issue report, I hadn't ever even considered about negative energies. ;)
#13
#14
Automatically closed -- issue fixed for 2 weeks with no activity.