Skip to content

Commit

Permalink
Fixing ordering by rating and rating_count (don't use fullordering!)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hunziker committed Apr 28, 2017
1 parent ee82188 commit 95dcb6a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
13 changes: 4 additions & 9 deletions administrator/components/com_content/models/articles.php
Expand Up @@ -52,7 +52,8 @@ public function __construct($config = array())
'author_id',
'category_id',
'level',
'tag'
'tag',
'rating_count', 'rating',
);

if (JLanguageAssociations::isEnabled())
Expand Down Expand Up @@ -322,14 +323,8 @@ protected function getListQuery()
}

// Add the list ordering clause.
$orderCol = $this->state->get('list.fullordering', 'a.id');
$orderDirn = '';

if (empty($orderCol))
{
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'DESC');
}
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'DESC');

$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));

Expand Down
13 changes: 4 additions & 9 deletions administrator/components/com_content/models/featured.php
Expand Up @@ -55,7 +55,8 @@ public function __construct($config = array())
'author_id',
'category_id',
'level',
'tag'
'tag',
'rating_count', 'rating',
);
}

Expand Down Expand Up @@ -220,14 +221,8 @@ protected function getListQuery()
}

// Add the list ordering clause.
$orderCol = $this->state->get('list.fullordering', 'a.title');
$orderDirn = '';

if (empty($orderCol))
{
$orderCol = $this->state->get('list.ordering', 'a.title');
$orderDirn = $this->state->get('list.direction', 'ASC');
}
$orderCol = $this->state->get('list.ordering', 'a.title');
$orderDirn = $this->state->get('list.direction', 'ASC');

$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));

Expand Down
Expand Up @@ -18,7 +18,7 @@
$app = JFactory::getApplication();
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = str_replace(' ' . $this->state->get('list.direction'), '', $this->state->get('list.fullordering'));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
$columns = 10;
Expand Down
Expand Up @@ -17,7 +17,7 @@

$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = str_replace(' ' . $this->state->get('list.direction'), '', $this->state->get('list.fullordering'));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'fp.ordering';
$columns = 10;
Expand Down

0 comments on commit 95dcb6a

Please sign in to comment.