This might be related to #736846: nodereference_count_update_count should use vid rather than nid, but I noticed some odd behaviour on my site. Some older articles (“songs”) I had seemed to have a higher reference count than there actually were references to. When diving into the database a little I saw that some articles (“lists”) that reference songs consisted of two rowes with the same nid, but a different vid. Only then I discovered those lists had revisions. (Apparently done while using the Scanner module).

Now the songs that are referenced from the lists that have a revision seem to count the references from all revisions. That is not what I want, there is one current revision and I only want that one counted for the reference count.

In this case I can do without the revision but I guess this is a bug, or it might be by design, I don’t know. Hence the reference to #736846: nodereference_count_update_count should use vid rather than nid.

I hope I made clear what the trouble was. Apart from this issue it is a very nice module. While using it I realised how much I needed this! Thanks.

CommentFileSizeAuthor
#3 787356.patch524 bytesgilgabar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gilgabar’s picture

I think I see what's going on. Issue #736846 was dealing with revisions of the nodes that are referenced and counted, while this is an issue with revisions of nodes that are referencing. Basically the sql query is too simple in that it is counting every row where the nid is equal to the node nid in question, but revisions confound that simplicity because there will be multiple rows with the same nid and different vids. It should be a straightforward fix. Hopefully tonight or tomorrow I'll have time to implement and test. Thanks for finding this. I don't make much use of revisions myself, so it's very much appreciated.

rolfmeijer’s picture

Neither do I, I never realised the Search and Replace Scanner module had added revisions! :-)

Thank you very much for your (quick) answer.

gilgabar’s picture

Status: Active » Needs review
FileSize
524 bytes

Ok, this patch should fix it. It's pretty simple. It just changes the query COUNT(*) to COUNT(DISTINCT nid). Please test and let me know if there are any problems. The dev version should be updated with the patch soon too.

rolfmeijer’s picture

Status: Needs review » Fixed

In my – fairly simple – testcase this is solved.
Wow, impressive, this is fixed very quickly! :-)

rolfmeijer’s picture

Status: Fixed » Reviewed & tested by the community

Sorry, wrong status I guess.

gilgabar’s picture

Status: Reviewed & tested by the community » Fixed

Great. We'll call this fixed then. It's in the current dev release and I'll roll a 1.1 update soon.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.