]> git.decadent.org.uk Git - memories.git/commitdiff
Search by random.
authorSimon Cozens <simon@simon-cozens.org>
Sat, 10 Feb 2007 12:12:55 +0000 (12:12 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Sat, 10 Feb 2007 12:12:55 +0000 (12:12 +0000)
git-svn-id: http://svn.simon-cozens.org/memories/trunk@22 041978f6-d955-411f-a9d7-1d8545c9c3c7

Memories.pm
Memories/Photo.pm

index e399e764040d3ad8f2506e78eb1bf5f52a8e6eb5..7027b09e400e3f7c9cd7defd3d2984b5d0027760 100644 (file)
@@ -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 {
index 5a9b91e56aa133ea4cda60c948a12a6d7e7a9bba..5af62e9dd57af4dea02cac11fea01a196bc613e0 100644 (file)
@@ -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) {