Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
7 Apr 2014 at 13:13 UTC
Updated:
2 Jun 2014 at 20:50 UTC
Jump to comment: Most recent
Comments
Comment #1
dahousecat commentedComment #2
dahousecat commentedComment #3
dahousecat commentedComment #4
dahousecat commentedComment #5
dahousecat commentedComment #6
dahousecat commentedComment #7
dahousecat commentedComment #8
dahousecat commentedComment #9
dahousecat commentedComment #10
Jeroen94 commentedI'm the one who asked a question on Drupal Answers about the feature to vote with half stars with Fivestar. I'm very thankful to Felix that he provided the 'Halfstar' module as it works quite well (there are still some problems) for my purposes. As far as I've tested the module, everything works, so I'm sure it'll help others in the future too. Hopefully 'Halfstar' will be launched officially on Drupal soon.
Comment #11
dahousecat commentedComment #12
dahousecat commentedComment #13
dahousecat commentedComment #14
dahousecat commentedScore doesn't display correctly for logged out users.
Comment #15
dahousecat commentedIssues all fixed.
Comment #16
dahousecat commentedAnother review...
Comment #17
dahousecat commentedAdded a review...
Comment #18
dahousecat commentedComment #19
dahousecat commentedReview added.
Comment #20
dahousecat commentedReview added.
Comment #21
dahousecat commentedreview
Comment #22
dahousecat commentedreview
Comment #23
davidpetit commentedHi ! I just tested your module. It's working well, I can indeed vote with halfstars.
There is just a small css issue if I choose to display both user vote and the average vote:
When there is not halfstar, the fields for voting are side by side whereas with halfstar it' broken. It's because with halfstar we lose a float:left on the .form-item div. You should fix this.
Other than that, I think we don't see it well that we can vote with half stars (even if there is the title tooltip with values). But this is just a UX notice.
Comment #24
dahousecat commentedHi David,
Thanks for your review. I fixed the minor CSS issue that you pointed out however this also made me aware of a bigger issue: When the average and users votes are displayed then the average score displayed in text below the stars is double what it should be.
I'm setting my status back to needs work whilst I'm working on a fix for this issue.
In response to it being a bit hard to see voting with half stars changing the widget will help. I've also considering adding some new widgets that are specifically designed for voting with half stars too.
Comment #25
davidpetit commentedOk dahousecat,
I am glad to have helped and that it even made you see another issue. It will definitely improve the module.
Concerning the idea of having new widgets designed for halfstar, it could help indeed.
By the way, I checked the jquery plugin: http://www.fyneworks.com/jquery/star-rating/ and saw that you can even split it more than half and as you want.
Maybe we can have a more generic splitstar module ? Then you can do not only half but also custom split. :)
Comment #26
dahousecat commentedIssue fixed.
Used hook_theme_registry_alter to add a pre-proccess function to theme_fivestar_summary and a drupal_static variable to determine if halfstar is enabled.
Comment #27
klausimanual review:
But otherwise looks RTBC to me. Assigning to dman as he might have time to take a final look at this.
Comment #28
dahousecat commentedHi Klaus,
Many thanks for the review.
Comment #29
dman commentedVisual review only just now tonight...
Two things stuck out to me.
I may be wrong, but it looks like you are converting the values up to double (and back to half) everywhere in the code, in fact that seems to take up most of the work.
The natural expectation would be for 1-and-a-half stars to be stored as 1.5 etc, yet you convert it to 3/10 ? It that what I'm seeing?
This decision has a LOT of knock-on effects
- if someone wanted to build a chart or a graph or a report of the results, then numbers are wrong.
- If someone has an already-running site and wants to add this module, then numbers become wrong.
- If someone wants to turn this module off, or make it optional, then the numbers are wrong or incompatible.
I can guess that you went down this road because the main storage mechanism was long ago assumed to be an int - but what I would really suggest is revisiting that assumption and fixing/modifying that. You will probably save a good third of the code that's doing busy-work just-in-time conversion everywhere here.
That's not to say there is anything wrong with the code (review-wise) - just that it may be a bad idea (code-wise) to solve the task in this way.
Point 2:
Have you raised this for discussion or a feature request within fivestar itself? It feel s like a lot of the structure you are needing to add with *_alter() callbacks (though correct) could be significanlty less work if you were to contribute a patch directly to fivestar itself.
As in the Project Application Checklist
This functionality is not a 'duplication' at all - in fact it's a straightforward linear enhancement of fivestar, and it would be great to see it aim for inclusion in that suite directly. Existing feature requests for "Half star functionality in fivestar (that I see you've posted to also) suggests that converting between 5 and 10 may not be at all necessary, and that the guys there seem to think that it's entirely possible with only css. I'm not sure about that - but it may be worth getting involved there.
(Sorry, it's late here, I'll have a look at the code line-by-line a little later.)
Comment #30
dahousecat commentedHi Dan,
Thanks for taking a look at the module.
Your right about most of the code dealing with doubling and halving the rating and number of stars, however the score actually stored in votingapi_vote table is correct.
The module doubles the number of stars and the score before it is displayed on the screen as each star actually consists of 2 stars to allow voting on each half individually.
Enabling and disabling the halfstar feature does not change the existing score. A CSS only solution would cause the rating saved to be halved, and the tooltip and descriptions would be also be wrong.
I would be happy to convert this project into a patch for the fivestar module. I initially went down this route as I've not contributed any code before at all before it seemed slightly less daunting to do this as separate module than to submit a patch to an existing one (not sure if that's very logical but still true).
I also felt that most people who use fivestar probably won't use this feature and I'm aware of several module that have started to suffer from bloat. There have been times when I've not used an existing module that offers the functionally that I need as it also does so much more and I don't want all that extra code in my project. I suppose it is about striking a balance, but a certain level of modular design does seem desirable.
Comment #31
klausiSounds all reasonable to me and the objections from dman don't seem to be blockers either, so ...
Thanks for your contribution, dahousecat!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #32
dahousecat commentedWoo hoo - how exiting!
Thank you :)