Gossamer Forum
Home : Products : Links 2.0 : Customization :

Ratings Tracking System

Quote Reply
Ratings Tracking System
Hi All.

Well, yet-another-request!

I would like to have a method of tracking all new 'ratings' that have been made for X days.

I guess the best method for this would be an a seperate page.

To expand on those:

Just a page that shows the X most recent ID's that have had a "rating" placed on them.

Any thoughts?



------------------
John B. Abela
Owner, 4CM
www.4cm.com/
support@4cm.com

Presently working on:
http://www.4cm.com/cmp3/
Finished: http://www.humbee.com/buzz/


Quote Reply
Re: Ratings Tracking System In reply to
Are you using a separate rating/review DB, such as with Widgetz' review mod? If so, you should be able to adapt the Last X Links code fairly easily... if not, you will need to create a new field LastReviewDate in your links DB which will get updated by rate.cgi...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)
Quote Reply
Re: Ratings Tracking System In reply to
 
Quote:
Are you using a separate rating/review DB, such as with Widgetz' review mod?

Nope. So that should be the first thing.
Alright, that shouldn't be to hard <smile>


Quote:
If so, you should be able to adapt the Last X Links code fairly easily...

Well, I am already using the "Last X Submitted" mod. Does that help?

Quote:
if not, you will need to create a new field LastReviewDate in your links DB which will get updated by rate.cgi...

Ooo' this is getting good now...

Ok, I'm following you so far!


Thanks!

------------------
John B. Abela
Owner, 4CM
www.4cm.com/
support@4cm.com

Presently working on:
http://www.4cm.com/cmp3/
Finished: http://www.humbee.com/buzz/


Quote Reply
Re: Ratings Tracking System In reply to
Just to be clear, it's one or the other... either switch over to an external ratings DB (like Widget'z Review mod) which will likely necessitate re-setting your ratings (painful) OR add a new field to your existing DB. You don't (and shouldn't) have to do both...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)
Quote Reply
Re: Ratings Tracking System In reply to
Hi.

Ok, lets say I go with the option of just adding another field to my database. (which I know how to do).

And I call it: LastReviewDate.

What then?

I'm gonna need step-by-step directions for this one!

Thanks oldmoney!

------------------
John B. Abela
Owner, 4CM
www.4cm.com/
support@4cm.com

Presently working on:
http://www.4cm.com/cmp3/
Finished: http://www.humbee.com/buzz/


Quote Reply
Re: Ratings Tracking System In reply to
OK, don't add that field just yet to your DB... one last question: do you want all records with a review added in the last 14 days or the last 10 records with a review? I need to know before starting the code, and I may have thought of a way to not need to add that field, but I'm still mulling it over...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited February 23, 2000).]
Quote Reply
Re: Ratings Tracking System In reply to
uuu... mulling and thinking... my favorite activity!

Originally, and still, I was thinking that I wanted a method to see which links had been reviewd within the last 24 hours. (or so)

Something that I can check every couple of days. See whats hot, and know from that what's just wasting space!

Also, I haven't touch my db yet. so no worries here!

One Happy, Happy, Person!
Later,

------------------
John B. Abela
Owner, 4CM
www.4cm.com/
support@4cm.com

Presently working on:
http://www.4cm.com/cmp3/
Finished: http://www.humbee.com/buzz/


Quote Reply
Re: Ratings Tracking System In reply to
OK, here's what I'm doing... everytime a valid rating comes in, rate.cgi opens a ratelog.txt file, compares all the existing entries to the current time, deletes ones that are older than 24 hours (configurable), and adds the current ID and time for the link just rated. I don't have rate.cgi anymore on my implementation, so I *believe* this will work but haven't tested it-- CAVEAT EMPTOR.

Now for the codes... in rate.cgi, right after (but before the final close bracket)
Code:
&site_html_rate_success;
}
add this...
Code:
#Rate Log File Mod
$timedelay = 24; #in hours
open (LOG, "<$db_rates_path/ratelog.txt");
@lines = <LOG>; # Slurp the database into @lines..
close LOG;
LINE: foreach $line (@lines) {
chomp ($line);
($logid, $logtime) = split /\s/, $line;
if (($time - $logtime) < ($timedelay * 3600)) { #measured in seconds
$output .= $line . "\n";
}
}
$output .= $id . "\t" . $time . "\n";
open (LOG, ">$db_rates_path/ratelog.txt");
print LOG $output;
close LOG;

You *may* have to chmod the ratelog.txt file to 666, but probably not. If you want to substitute the actual link title for the ID, it will require a few minor changes. Since this is primarily used in the admin interface, you will probably want to add a link to ratelog.txt to admin.html in sub html_navigation.

Let me know if it worked...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited February 23, 2000).]
Quote Reply
Re: Ratings Tracking System In reply to
Ok, I did as instucted.

It appears to be working, however, a few questions.

I rated a site with the id of: 66

It inserted the following into the blank ratelog.txt file:

Quote:
66 951341337

Now it beats the tar-snot out of me what the latter numbers are... but it got the siteId correct! Smile


oppp.. once problem I just discovered (but my no means complaining! <smile> )... I went back to try to resubmit it... the standard message "you can't you already did" showed... but it logged it in the ratelog.txt file. While this is not something I really care about all that much... just thought I'd share that with you.

Again, this is great! Thanks for the thoughs and time for this!

Hope this was one of those rare questions that you get that asks for something you haven't already discussed a billizion times!

Again, thank you!


------------------
John B. Abela
Owner, 4CM
www.4cm.com/
support@4cm.com

Presently working on:
http://www.4cm.com/cmp3/
Finished: http://www.humbee.com/buzz/


Quote Reply
Re: Ratings Tracking System In reply to
In ratelog.txt, the first number is the ID (of course!) and the second is the time since Jan 1, 1970 in seconds (a standard Unix measure of time). If you were going to use this mod for "public consumption", we'd have to clean it up to 1) convert the ID into the relevant link title and 2) convert the seconds into a date.

If you haven't used rate.cgi before, it creates a temporary file with the link id as the name ('66'). In that file, you see the number of votes, the rating, the time (in seconds again) and the voter's IP address. This file (or files if multiple links have been rated) gets incorporated into your main link DB by nph-build.cgi and then deleted on each re-build (hence, IP-based vote blocking effectively *expires* on each re-build). The ratelog.txt shouldn't be touched by nph-build.

The real test will be to see if the ratelog mod automatically deletes old ratings from ratelog.txt after 24 hours.

As for the duplicate voting, putting
Code:
exit;
after
Code:
&site_html_rate_failure ("Sorry, you've already rated for this resource once recently.");
should do the trick...

I don't undertake requested mods unless they are fairly unique... this is the second (or third?) problem you have presented that I've taken a crack at, and you should be credited for thinking "out of the box". Smile

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited February 23, 2000).]
Quote Reply
Re: Ratings Tracking System In reply to
I'll update you at 1500 tomorrow!

------------------
John B. Abela
Owner, 4CM
www.4cm.com/
support@4cm.com

Presently working on:
http://www.4cm.com/cmp3/
Finished: http://www.humbee.com/buzz/


Quote Reply
Re: Ratings Tracking System In reply to
You could always manually change the existing time stamp to 900000000, rate another link and see if it works now. Wink

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)