diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-06-05 23:47:47 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-06-05 23:47:47 -0700 |
commit | 4e56176f35fe624d2d3a587636a4a45ea387be09 (patch) | |
tree | 8951394427b01adb7b21e733abd2495d606c0924 /modules/gallery/helpers | |
parent | 87fde3f360d557d48241d09cae4f25949e748d4f (diff) |
item::random_query() doesn't need to take a "where" clause because
it's returning a query, so the caller can add the where clause
himself. This makes for a cleaner API.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/item.php | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 43c93225..bbbe1058 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -209,17 +209,14 @@ class item_Core { /** * Return a query to get a random Item_Model, with optional filters - * - * @param array (optional) where tuple */ - static function random_query($where=null) { + static function random_query() { // Pick a random number and find the item that's got nearest smaller number. // This approach works best when the random numbers in the system are roughly evenly // distributed so this is going to be more efficient with larger data sets. return ORM::factory("item") ->viewable() ->where("rand_key", "<", ((float)mt_rand()) / (float)mt_getrandmax()) - ->merge_where($where) ->order_by("rand_key", "DESC"); } }
\ No newline at end of file |