From 79a133c5b5ef5e8a4879a8bfaaf43fc119be7631 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Sat, 10 Feb 2007 12:12:55 +0000 Subject: [PATCH] Search by random. git-svn-id: http://svn.simon-cozens.org/memories/trunk@22 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- Memories.pm | 2 ++ Memories/Photo.pm | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Memories.pm b/Memories.pm index e399e76..7027b09 100644 --- a/Memories.pm +++ b/Memories.pm @@ -113,8 +113,10 @@ sub do_cached { } sub _recent_uploads { Memories::Photo->search_recent() } +sub _random { Memories::Photo->search_random() } sub recent_uploads { shift->do_cached(\&_recent_uploads) } +sub random { shift->do_cached(\&_random) } sub tagcloud { shift->do_cached(\&_tagcloud) } sub _tagcloud { diff --git a/Memories/Photo.pm b/Memories/Photo.pm index 5a9b91e..5af62e9 100644 --- a/Memories/Photo.pm +++ b/Memories/Photo.pm @@ -14,7 +14,8 @@ BEGIN { my %order_by = ( recent => "uploaded", popular => "hit_count", - interesting => INTERESTINGNESS_ALGORITHM + interesting => INTERESTINGNESS_ALGORITHM, + random => "rand()" ); while (my($label, $how) = each %order_by) { -- 2.39.5