Hi

I am trying to make a custom block using votingapi tags to separate the "normal" votes from the "special" votes i need, but from the query i see that CRE does, this tags are not filtered:

I've reached to this query (approx):

SELECT d.content_id2 as 'content_id',sum(d.sum+d.count*r.value)/sum(d.count) as 'score',n.title
    FROM cre_similarity_matrix d,votingapi_vote r,node n 
    WHERE d.content_type1='product'
    AND r.content_type = d.content_type1
    AND n.type = d.content_type1
    AND d.content_id1<>r.content_id 
    AND d.content_id2=r.content_id 
    AND n.nid=d.content_id1 
    AND r.tag = 'customer_related'   <--- here is the custom tag filter
    AND n.nid<> %d
    AND d.content_id2 = %d
    GROUP BY d.content_id1 ORDER BY score DESC

But if there are nodes voted in more than one tag, wrong results are returned, as there is no tag column in cre_similarity_matrix, so the values returned are from all tags and not from the tag selected.

I think that adding a tag field on cre_similarity_matrix and populating it on cre_modify_avg_difference() function from cre.module file will be enough, am i missing something?

I will implement the changes on my local site and test them.

CommentFileSizeAuthor
#1 cre_diff.patch1.72 KBpcambra

Comments

pcambra’s picture

StatusFileSize
new1.72 KB

Hi, there is no answer for now, so i post the changes i've made to cre module to include tag support.

here is the alter table to get tags working
ALTER TABLE cre_similarity_matrix ADD tag VARCHAR(128);

And I attach de diff file of the changes made.

jonhattan’s picture

Version: 5.x-1.0 » 5.x-1.x-dev
Status: Active » Needs work

Patch doesn't apply.