jenkins-bot has submitted this change and it was merged.

Change subject: Readers: Fixed grid sorting
......................................................................


Readers: Fixed grid sorting

Sorting was not implemented.

Patch set 2

Change-Id: I8eef2ecd42d572f3de4ce1c4283669b6363808a2
---
M Readers/Readers.class.php
1 file changed, 29 insertions(+), 13 deletions(-)

Approvals:
  Tweichart: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Readers/Readers.class.php b/Readers/Readers.class.php
index f65c7fd..88f9516 100644
--- a/Readers/Readers.class.php
+++ b/Readers/Readers.class.php
@@ -265,7 +265,13 @@
                $sSort = $oStoreParams->getSort( 'MAX(readers_ts)' );
                $sDirection = $oStoreParams->getDirection();
 
-               if ( $sSort == 'user_page' ) $sSort = 'readers_user_name';
+               if ( $sSort == 'user_name' ) {
+                       $sSort = 'readers_user_name';
+               } elseif ( $sSort == 'user_ts' ) {
+                       $sSort = 'readers_ts';
+               } elseif ( $sSort == 'user_readers' ) {
+                       $sSort = 'readers_user_name';
+               }
 
                $oDbr = wfGetDB( DB_SLAVE );
                $res = $oDbr->select(
@@ -365,21 +371,31 @@
                $iLimit = $oStoreParams->getLimit();
                $iStart = $oStoreParams->getStart();
                $sSort = $oStoreParams->getSort( 'MAX(readers_ts)' );
+               $sDirection = $oStoreParams->getDirection();
 
-               if ( $sSort == 'user_page' ) $sSort = 'readers_user_name';
+               if ( $sSort == 'pv_page' ) {
+                       $sSort = 'page_title';
+               } elseif ( $sSort == 'pv_ts' ) {
+                       $sSort = 'MAX( readers_ts )';
+               }
 
                $res = $oDbr->select(
-                               array( 'bs_readers', 'page' ),
-                               array( 'readers_page_id', 'MAX(readers_ts) as 
readers_ts' ),
-                               array( 'readers_user_id' => $iUserID ),
-                               __METHOD__,
-                               array(
-                                       'GROUP BY' => 'readers_page_id',
-                                       'ORDER BY' => 'MAX(readers_ts) DESC',
-                                       'LIMIT' => $iLimit,
-                                       'OFFSET' => $iStart
-                               ),
-                               array( 'page' => array( 'INNER JOIN', 
'readers_page_id = page_id' ) )
+                       array( 'page', 'bs_readers' ),
+                       array(
+                               'page_title', 'readers_page_id', 
'readers_user_name',
+                               'MAX( readers_ts ) as readers_ts'
+                       ),
+                       array(
+                               'readers_page_id = page_id',
+                               'readers_user_id' => $iUserID
+                       ),
+                       __METHOD__,
+                       array(
+                               'GROUP BY' => 'readers_page_id',
+                               'ORDER BY' => $sSort . " " . $sDirection,
+                               'LIMIT' => $iLimit,
+                               'OFFSET' => $iStart
+                       )
                );
 
                $aPages = array();

-- 
To view, visit https://gerrit.wikimedia.org/r/237343
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8eef2ecd42d572f3de4ce1c4283669b6363808a2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: Dvogel hallowelt <daniel.vo...@hallowelt.com>
Gerrit-Reviewer: Dvogel hallowelt <daniel.vo...@hallowelt.com>
Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz>
Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz>
Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: Tweichart <weich...@hallowelt.biz>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to