diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-03-04 16:21:37 -0800 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-03-04 16:21:37 -0800 |
commit | 77e4fad9fac63151c3eee0c3c785c8cf2fa356fb (patch) | |
tree | 9803f20b702a6233d67bd201166268f9780e5e4e /actions | |
parent | 36bb33fb1d7b4befe2fb68c2eef0712619359293 (diff) | |
parent | e239a5529abc0958c4f874811ff704f1e5d6ba62 (diff) |
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Diffstat (limited to 'actions')
-rw-r--r-- | actions/favorited.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actions/favorited.php b/actions/favorited.php index fd5ff413c..5082f4a4e 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -169,8 +169,14 @@ class FavoritedAction extends Action function showContent() { + if (common_config('db', 'type') == 'pgsql') { + $weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))'; + } else { + $weightexpr='sum(exp(-(now() - fave.modified) / %s))'; + } + $qry = 'SELECT notice.*, '. - 'sum(exp(-(now() - fave.modified) / %s)) as weight ' . + $weightexpr . ' as weight ' . 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . 'GROUP BY fave.notice_id ' . 'ORDER BY weight DESC'; |