Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When i set the output to percentage i'l get this error when viewing the node;
warning: Division by zero in C:\wamp\www\ashladan2\sites\all\modules\fivestar\fivestar_field.inc on line 297.
don't think this is good :)
Comment | File | Size | Author |
---|---|---|---|
#7 | fivestar-531200-a.patch | 901 bytes | ezra-g |
#2 | fivestar-531200.patch | 901 bytes | ezra-g |
Comments
Comment #1
FL4PJ4CK CreditAttribution: FL4PJ4CK commentedI've got exactly the same problem. Any ideas?
line 297 is "}"...
Comment #2
ezra-g CreditAttribution: ezra-g commentedWe can't do any of the calculations without both the rating and # of stars values, so we should probably return 0. Does this patch help?
Comment #3
demon326 CreditAttribution: demon326 commentedezra-g, can you make a simple find an replace for non coder users? thx!
Comment #4
ezra-g CreditAttribution: ezra-g commented@demon326 -- Check out http://drupal.org/node/323498 for instructions on applying a patch ;). It's not too hard :).
Comment #5
demon326 CreditAttribution: demon326 commentedezra-g, it's not working.. you also forget to add a "}" after the
return round(100/$element['#item']['rating'], 1)/$element['#field']['stars'];
line, and it stays saying that the above line is the problem..the full code block:
Comment #6
ezra-g CreditAttribution: ezra-g commented@demon326: Did you actually apply and review this patch? It resolves the issue for me, and there is no missing bracket in the code once it is applied.
Comment #7
ezra-g CreditAttribution: ezra-g commentedTurns out this needed a slight change - to check for empty($element['#field']['stars']) instead of empty($element['#item']['stars'])) .
Comment #8
ezra-g CreditAttribution: ezra-g commentedThis is now committed.
Comment #9
pescobar CreditAttribution: pescobar commentedThis bug also showed up for me on the search results page when a fivestar-enabled content type was included in the results
however, in my testing on the search results page, the '$element['#field']['stars']' is always empty but '$element['#item']['stars']' always has a value
are there cases where '$element['#field']['stars']' has a value?
maybe if the function is entered in some other page other than search results?
Comment #10
ezra-g CreditAttribution: ezra-g commentedAre you getting this error on the same line as reported in this issue, with the latest dev release?