]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/favorited.php
you can _so_ leave a group if you're its admin
[quix0rs-gnu-social.git] / actions / favorited.php
index fd5ff413cbbfd9cc8f0ac478c7aa084a7c0d43ca..5082f4a4eb3e5ae258c67804516924c73907c686 100644 (file)
@@ -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';