Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Commit

Permalink
Add proper owner's area sort ordering
Browse files Browse the repository at this point in the history
Sort ordering now is same as owner sort ordering.

Close #14
  • Loading branch information
Red-Teapot committed May 12, 2017
1 parent 7a1641b commit d8f762e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/backend/logic/PlayerRegionsAreas.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ public function __construct($db) {

public function getAreas($order = 'nickname', $order_dir = 'asc') {
$owner_order = (strtolower($order) == 'nickname' ? '`owner_nickname`' : 'SUM(`area`)');
$area_order = (strtolower($order) == 'nickname' ? '`label`' : '`area`');
$order_dir = (strtolower($order_dir) == 'asc' ? 'ASC' : 'DESC');

$sql = "SELECT `label`, `area`, `owner_nickname` FROM `regions` ORDER BY `name` ASC;";
$sql = "SELECT `label`, `area`, `owner_nickname` FROM `regions`
ORDER BY " . $area_order . " " . $order_dir . ";";
$stmt = $this->db->query($sql);
$areas = $stmt->fetchAll();

Expand Down

0 comments on commit d8f762e

Please sign in to comment.