Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Top 10 bug revisited

Quote Reply
Top 10 bug revisited
I do understand the top 10 bug a little...

But, it showed 12 links -- my #8 #9 and #10 were 8 hits each, and #11 and #12 were 7 hits each. Links #5 and #6 were 10 each, so it's not just a count of each 'value'

There has to be an off-by-one error, since links #11 and #12 should not have shown given the previous explanations of the problem.

Quote Reply
Re: Top 10 bug revisited In reply to
well.. it's obviously a calculation problem that you can't fix.. (well not easily).. just like the problem with 5 columns

so do it the easy way.. Smile

go to build_cool_page

under:

Code:
$total++;

add

Code:
($LINKS{build_pop_cutoff} < 1 and $total == $LINKS{build_pop_cutoff}) and last;

hehe Smile

jerry
Quote Reply
Re: Top 10 bug revisited In reply to
Thanks for the fix. But don't you mean:

($LINKS{build_pop_cutoff} > 1)

Cheers,

Alex
Quote Reply
Re: Top 10 bug revisited In reply to
no..

see the thing is that you want both $LINKS{build_pop_cutoff} > 1 and $LINKS{build_pop_cutoff} == $total..

anyways.. yea.. just think about that again one more time..

anyways.. you might want to fix the calculation rather than doing it this way.. i'm not exactly sure what's wrong with the calculation as it gives me a headache thinking..

oh yea.. GOOD NEWS.. the project i thought was due tommorrow is due NEXT week Wink i guess when i hear due "Tuesday" i think it's the upcoming tuesday..

jerry

jerry
Quote Reply
Re: Top 10 bug revisited In reply to
No, but what I mean is you had build_pop_cutoff less then 1, where I think you meant greater then 1.

The problem is that the cutoff value is calculated and all the popular links are tagged using an UPDATE clause, and if you have lots of links with the same cutoff, they are all tagged popular. The limit statement doesn't seem to have any affect.

I'll look at redoing this somehow.

Cheers,

Alex
Quote Reply
Re: Top 10 bug revisited In reply to
Alex,

you mean if you update the "popular" tags, then do a select such --

select from links where isPopular=True order by Hits limit 10 (pseudo query)

-- doesn't work? Or the compound statement doesn't work?

Quote Reply
Re: Top 10 bug revisited In reply to
oh.... DUH Smile i didn't look close enough

geez.. lately i've been feeling REALLY sleepy.. but i sleep more and more.. so it's weird.. maybe it's cause of my no sleep summers..

i blame it on my computer screen being too bright.. Smile

jerry
Quote Reply
Re: Top 10 bug revisited In reply to
Pugdog: No, popular links are calculated in the following steps:

1. Figure out how many links should be popular (either by $total * cutoff, or just cutoff).
2. Do a:
SELECT Hits FROM Links ORDER BY Hits DESC LIMIT cutoff,1

You now have the cutoff value and I was just doing:
UPDATE Links SET isPopular = 'Yes' WHERE Hits > cutoff_hits LIMIT cutoff

However, this could set more then the intended number of links if a lot of links had the same cutoff value.

What I've done is just do a select on all the popular links and update them one by one. It's a bit slower but it will do it right.

Cheers,

Alex