On my site I've created a content type for creating reviews. Reviews get a rating by the author through the five star module (field_review_rating). The rating is displayed in a block view on the site and next to the article. However the newest review is not displaying the given score in the block on the main page. If I check the element that should provide the score I get the following code:
<div class="fivestar-widget-static fivestar-widget-static-vote fivestar-widget-static-5 clearfix">
<div class="star star-1 star-odd star-first">
<span class="off">0</span>
</div>
<div class="star star-2 star-even">
<span class="off"/>
</div>
<div class="star star-3 star-odd">
<span class="off"/>
</div>
<div class="star star-4 star-even">
<span class="off"/>
</div>
<div class="star star-5 star-odd star-last">
<span class="off"/>
</div>This is incorrect, because the preview does have, in this case, a rating of 4. When I check the block view through admin/structure/views/view/Review/edit I do see the correct score being displayed in the block. All other items (I display 3 in the single block) do show their rating correctly.
It is very odd behavior, because after some time (might be 1-2 weeks) the score is displayed next to the first block item. Given this behavior I thought it might be cache, but even purging that doesn't show the rating for the first item in my list. The behavior only occurs with the block view associated with the review.
Did I forget something during my initial setup or do we have a bug?
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | rating_not_showing_on_blocks-1506582-11.patch | 1.57 KB | marcelovani |
| #3 | rating_not_showing_block_on_site-1506582-854220.patch | 1.6 KB | marcelovani |
Comments
Comment #1
oobie11 commentedSame issue here
Comment #2
marcelovaniAfter some debugging I found that the block can display the ratings properly only once, which means, if there is a page and a block that display the rating for the same node, the first to render will display it.
In my case I have a page that displays reviews and a block that displays latest reviews. The page displays the ratings correctly but the block comes with no ratings.
Comment #3
marcelovaniThe bug happens is due to the fact that the first time the ratings are processed, the array of items is overridden and the information is no longer available on the second render.
I am attaching a patch that creates an extra key on the array, keeping the original keys untouched.
Comment #5
ericduran commentedThis makes sense. But it seems like is breaking some of the test.
We should get fix the issue and hopefully get this in.
Comment #6
ericduran commented#3: rating_not_showing_block_on_site-1506582-854220.patch queued for re-testing.
Comment #8
marcelovaniThe tests are failing but should be something else, not related to the fix.
I have been using this patch for nearly a month now and it works well.
Comment #9
marcelovani#3: rating_not_showing_block_on_site-1506582-854220.patch queued for re-testing.
Comment #11
marcelovaniRe-patched and tested locally, need help to test it and possibly getting this fix committed.
To simulate the problem
Comment #12
marcelovaniSee also http://drupal.org/node/539444#comment-6677482
Comment #14
fenda commentedThe patch in #11 worked for me.
Comment #15
kristen polPatch #11 works great!
Comment #16
Berliner-dupe commentedPatch 11 make new errors ...
Now Fivestar will show in Views-Block correct but in Node only when Stars (rated while editing) is selected. If you select Stars (rated while viewing) Fivestar-field will not show in all new Nodes as normal field.
The Fivestar-Fields in new Nodes show only label now - the Fivestar-Widget is away. I tested a few content-types - same problem everywhere.
Has anyone an idea?
Comment #17
Berliner-dupe commentedComment #18
end user commentedThe patch in #11 worked for me with fivestar-7.x-2.x-dev Oct 23/2013
Comment #19
s_gupta_14 commentedWas facing same issue patch #11 worked for me
Comment #20
marcoka commented#11 helped me too. Without it my site went to shit :)
thank you.
i will monitor if i will have the same problems as "Berliner" and report back.
Comment #21
marcoka commentedComment #22
whiteph commentedReduced priority back to "Normal". See Priority levels of issues. Normal is: Bugs that affect one piece of functionality are normal priority. An example would be the category filter not working on the database log screen. This is a self-contained bug and does not impact the overall functionality of the software.
I re-rolled the patch for the latest 7.x-2.x-dev release, and the tests still fail dramatically i.e. this patch breaks normal functionality. I'll take a more detailed look at this issue, but it will have to wait for its turn in the queue.
Comment #23
marcelovaniIn fact the problem no longer exists.
I believe the fix happened here https://drupal.org/node/1853760
I would suggest to close this ticket.
Comment #24
whiteph commentedGreat, thanks for the feedback.