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

Beginner's question: sorting by rates

Quote Reply
Beginner's question: sorting by rates
Hello,

just only a beginners questions:

where do I change the script to sort by rates (10 points very high, then 9.xx and so on...)

I have found the sorting line at Links.pm:

$LINKS{build_sort_order} = "isNew,isPopular,Rating,Title";

but there is one problem:

the links were displayed with 0.00 first, and NOT the 10.00 rated links...

where I do change a to b ? I have searched for it in all scirpt, but I am not able to locate it *hmmm*

Greetings and thanks for suggestions (and solutions *g*),

Marcus.
Quote Reply
Re: Beginner's question: sorting by rates In reply to
Hello to all,

let's continue the problem:

I know that I have to made a change either in changing ASC to DESC or change the $a and $b variables...

I have played around but I am not able to locate the problem:

I want to display in categories (also in search results) the newest, then the pops, then the best rated links...

At this moment, LINKS SQL diplays the worst rated links, than the best rated, the newest and the popst - that's not okay I think...

Also another problem: I want to tell new links subcribers the link ID (for external rate scripts) of their added link, but the variable <%ID%>, also the variable <%LinkID%> in the template email-add.txt does not work...any idea which variable to use ?

Thanks for Your help in advance...

Marcus.
Quote Reply
Re: Beginner's question: sorting by rates In reply to
The link ID is not available untill it has been validated. It can be made available to the email-add.txt template by doing the following:
In the admin.cgi, sub validate_records
Search for
Quote:
$result = $db->add_record ( \%{$links{$id}} );
$result or ($error{$id} = "<li>$id (Couldn't add: $Links: BSQL::error)") and next;
Add this after that...
Quote:
my $my_id = $result;

Now look for:
Quote:
&html_validate_email ($in, $db, { Category => $name, %{$links{$id}} });

And change it to read:

Quote:
&html_validate_email ($in, $db, { Category => $name, Myid => $my_id, %{$links{$id}} });

Now you can use <%Myid%> in your email-add.txt template.

There is no way to tell the user his id when he adds the link, as the id isnt generated untill it is added during validation.

Chris

[This message has been edited by Digital Concepts (edited November 13, 1999).]
Quote Reply
Re: Beginner's question: sorting by rates In reply to
change:


$LINKS{build_sort_order} = "isNew,isPopular,Rating,Title";



$LINKS{build_sort_order} = "Rating DESC, Title";

Or whatever... you use ASC and DESC right after the field name, but before the comma.
Quote Reply
Re: Beginner's question: sorting by rates In reply to
Hi,

I have changed the scripts - thanks to pugdog and D.C. !!!

The Link ID for validation emails works very fine - no problems...

The changing to sort Rating DESC does NOT work correctly, so I have to look where the problem is located - it seems that links places 2 links with 0.00 Rating, then 8.xx, then 10.00, 9.xx and so on ...- really funny and I have no plan what the script has sorted...

I have to check the links manually to control what the script has sorted - thanks for suggestions and tips...

dmk
Quote Reply
Re: Beginner's question: sorting by rates In reply to
This sounds like a bug in the alternate categories. I'll look into fixing this.

Cheers,

Alex
Quote Reply
Re: Beginner's question: sorting by rates In reply to
Alex,

I'm pretty sure I reported some problems with the sort routines last week (?) Seems he's hitting the same problem.

Quote Reply
Re: Beginner's question: sorting by rates In reply to
Hi Alex,

is the problem fixed at the new version (or are You still on fixing)

Greetings,

DMK-Support
Marcus Lutz
Quote Reply
Re: Beginner's question: sorting by rates In reply to
I'm still not getting sorts the way I'd expect... but because of all the various levels, I have to wait a few more days until I get all the installations up to 1.1 then I can tell if it's a legitmate bug or legacy one.

There _has_ been some problems with sort, but those routines have been heavily worked on in the past 2-3 releases.