Comment Widget settings not showing up

jazzdrive3 - September 9, 2009 - 15:59
Project:Fivestar
Version:6.x-1.18
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I've enabled Fivestar Comments, but in the Content Type edit screen, there is no "Comment Widget" section to add fivestar to comments. Just the normal Fivestar settings.

I'm also getting these errors:

* warning: Division by zero in .../sites/all/modules/fivestar/fivestar.module on line 1581.
* warning: Division by zero in .../sites/all/modules/fivestar/fivestar.module on line 1582.

When I disable the Fivestar Comments Module, I don't get these errors anymore.

#1

jazzdrive3 - September 10, 2009 - 05:02
Priority:normal» critical

Any ideas? This seems like a major bug.

#2

ezra-g - September 10, 2009 - 14:03
Category:bug report» support request
Priority:critical» normal
Status:active» postponed (maintainer needs more info)

Bumping an issue to critical several hours after filing it will not get it fixed sooner.

A) Are you using a custom theme?
B) If you clear the site cache does the comment widget return to the admin/content/node-type/[type] screen?
C) The error message you're reporting sounds like a duplicate of #531200: warning: Division by zero in sites\all\modules\fivestar\fivestar_field.inc on line 297.. Please apply the patch in that issue and review it there.

#3

jazzdrive3 - September 10, 2009 - 19:16

Not the same issue. The error is reporting a completely different file and line number.

Applied that patch anyway to see, but it didn't make a different.

Just using the default garland theme. Clearing cache did nothing.

#4

jazzdrive3 - September 13, 2009 - 03:41

Any ideas? Things to check/troubleshoot?

#5

Gonzalo.Cifaldi - October 24, 2009 - 16:14
Status:postponed (maintainer needs more info)» active

I have the same problem, I put this Bug Report, and a Support Request because I don't see before.
http://drupal.org/node/595424
http://drupal.org/node/608248
I change the status to duplicate.

I use the Division By Zero patch.

And I have this configuration on my computer:

Apache/2.2.8 (Xubuntu) PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch Server and PostgreSQL 8.3.8
I have installed Drupal 6.14, Amazon 6.x-1.0-beta7, Fivestar 6.x-1.18, Voting API 6.x-2.3, Nitobe 6.x-1.6

I create a content type named product review with fivestar rating (like in Using Drupal book from O'Reilly) and when I go to edit (/admin/content/node-type/review) in the Fivestar Ratings section I only see Direct rating widget, the comment widget settings isn't showing.

Also I have this two warnings:
warning: Division by zero in /var/www/drupal/sites/all/modules/fivestar/fivestar.module on line 1587.
warning: Division by zero in /var/www/drupal/sites/all/modules/fivestar/fivestar.module on line 1588.

Thanks.

#6

quicksketch - October 24, 2009 - 18:07

I create a content type named product review with fivestar rating (like in Using Drupal book from O'Reilly) and when I go to edit (/admin/content/node-type/review) in the Fivestar Ratings section I only see Direct rating widget, the comment widget settings isn't showing.

Make sure you've enabled the Fivestar Comments module (it comes with Fivestar) to see the comment widget settings.

#7

Gonzalo.Cifaldi - October 24, 2009 - 18:59

About the questions that ezra-g made to jazzdrive3
A) No, isn't custom, is Nitobe 6.x-4.1 standard
B) I do it and the problem continues.
C) I use a division by zero patch, i don't know if is the same that is write there.

I update some modules: Amazon from 6.x-1.0-beta7 to 6.x-1.0-beta10, and Fivestar from 6.x-1.18 to 6.x-1.19 and the problem continues. I have to change the version subject to 6.x-1.19?

About your question: I have enabled Fivestar Comments, I always have.

What more can I do, any idea is welcome.

Thanks.

#8

ositoblanco - October 30, 2009 - 22:00

The critical part is:

<?php
 
for ($i = 0; $i <= $element['#stars']; $i++) {
   
$this_value = ceil($i * 100/$element['#stars']);
   
$next_value = ceil(($i+1) * 100/$element['#stars']);
?>

I don't have to much time to understand what the calculation is for (missing documentation?), but I guess it is to calculate the average. So you just need to solve the question "What do we expect in case of $element['#stars'] is equal 0?" ... maybe something like:

<?php
$this_value
= $element['#stars']? ceil($i * 100/$element['#stars']) : 0; //not tested
$next_value = $element['#stars']? ceil(($i+1) * 100/$element['#stars']) : //;
?>

$this_value and $next_value will be 0 if $element['#stars'] is 0 ... but I'm not sure what the calculated values are for, therefore the concept needs a review and somebody to create a patch (if the logic is reviewed I could create the patch too).

#9

Gonzalo.Cifaldi - November 1, 2009 - 23:42

Thanks ositoblanco,

Do you think that this will make that the comment widget settings show up? Or that is only for the warnings?

#10

ositoblanco - November 4, 2009 - 16:00

I just saw these little errors and I don't like them (I don't know exactly where it is for) ... so I was diving a little (a very little) bit into the code to find the cause and had a spontaneous idea how it could be fixed ... the question is easy for someone who knows whats going on, its just defining the exceptions for $element['#stars'] == 0 to avoid the division by zero.

#11

acidrob - November 14, 2009 - 07:27

I have the same problem with the Fivestar comments not showing up, and also same divide by zero errors.

I have replaced the line identified with:

for ($i = 0; $i <= $element['#stars']; $i++) {
$this_value = ($element['#stars'] < 1) ? 0 : ceil($i * 100/$element['#stars']);
$next_value = ($element['#stars'] < 1) ? 0 : ceil(($i+1) * 100/$element['#stars']);

The comment widget is still not showing up - hopefully this should fix divide by zero problem though

#12

Gonzalo.Cifaldi - November 14, 2009 - 19:54

Hello Acidrob,

Can I ask what configuration have on your computer?
Want to know if the problem is in some packages from a distro or is a Drupal / Fivestar problem.

By the way, thanks for the advice about the divide by zero solution work. And thanks to ositoblanco for the solution.

Greetings.
Gonzalo.

Pd: ezra-g, why this is not a Bug report? Only to know.
Pd2: jazzdrive you found a solution? You make comment widget appear?

#13

jazzdrive3 - November 16, 2009 - 15:24

Nope. Still nothing works. I have already tried what others have suggested and gotten rid of the division by zero. Still nothing.

 
 

Drupal is a registered trademark of Dries Buytaert.