We post scoops to groups and for some reason (which I have not investigated), scoops were listed twice in the "best scoops" block.

I modified the query in the file drigg/drigg_blocks/drigg_blocks.module:

$query="SELECT * FROM {node} n LEFT JOIN {votingapi_cache} vc ON n.nid = vc.content_id WHERE ".drigg_votingapi_query('vc')." AND vc.value <> 0 AND n.created > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - 60*60*".variable_get("drigg_block_${var_name}_days", 48)." $only_promoted AND n.status=1 GROUP BY n.nid ORDER BY vc.value DESC LIMIT %d";

to:

$query="SELECT * FROM {node} n LEFT JOIN {votingapi_cache} vc ON n.nid = vc.content_id WHERE ".drigg_votingapi_query('vc')." AND vc.value <> 0 AND n.created > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - 60*60*".variable_get("drigg_block_${var_name}_days", 48)." $only_promoted AND n.status=1 GROUP BY n.nid ORDER BY vc.value DESC LIMIT %d";

The addition is the GROUP BY clause.

Is this the correct way of solving my problem? If not, do you have a suggestion were to start looking on WHY the posts appear twice?

Bart.

Comments

mercmobily’s picture

Hi,

Can you please provide the line number? Also, you posted the same query twice...
I think it's really strange that a scoop is posted twice. I don't think we should need the group by, but will investigate this further. In the meantime, can you have a look at the db to see why you are getting this?

I think i might have missed the content_type filter to the query, actually, so the query is picking up comments as well. Could that be it? (you tell me, since you have the db there...!)

Merc.

mercmobily’s picture

Hi,

Hellow?

Merc.

analogious’s picture

Yes, I accidentally posted the modified sql twice.

it's line: 324 of the file drigg/drigg_blocks/drigg_blocks.module I modified.

Like you suspected, blog posts and comments also appear in the block.

Posts do not appear twice any more when I revert the query to the original one. I played arround with the block config, but I cannot reproduce it for now. I'll let you know when it happens again including information regarding the db.

Bart.

mercmobily’s picture

Hi,

Can you please _quickly_ confirm that if you add:

AND n.type='drigg'

To the query, the problem is fixed?
Can you please also confirm that the queries on lines 214 and 256 ALSO need fixing? (with the AND n.type='drigg')

I have a pending commit right now. A swift response would simplify Drigg's development immensely. Thanks.

Merc.

mercmobily’s picture

Hi,

"A swift response would simplify Drigg's development immensely. Thanks."

Merc.

analogious’s picture

Hi,

It does fix my problem. Only scoops are displayed now in the best scoops block.

214 and 256 are ok already.

Thanks.

Bart.

mercmobily’s picture

Status: Active » Fixed

ok thanks

Anonymous’s picture

Status: Fixed » Closed (fixed)

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