diff --git a/www/admin/inner.js b/www/admin/inner.js index 7aa6841eb..b9acc0607 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -1095,26 +1095,30 @@ define([ }; var _reorder = function () { - var hashKeys = Object.keys(hashesById); + var orderAnswered = []; + var orderPremium = []; + var orderNormal = []; + var orderClosed = []; - var orderAnswered = hashKeys.filter(function (id) { + Object.keys(hashesById).forEach(function (id) { var d = getTicketData(id); - return d && d.lastAdmin && !d.closed; - }).sort(sort); - var orderPremium = hashKeys.filter(function (id) { - var d = getTicketData(id); - return d && d.premium && !d.lastAdmin && !d.closed; - }).sort(sort); - var orderNormal = hashKeys.filter(function (id) { - var d = getTicketData(id); - return d && !d.premium && !d.lastAdmin && !d.closed; - }).sort(sort); - var orderClosed = hashKeys.filter(function (id) { - var d = getTicketData(id); - return d && d.closed; - }).sort(sort); + if (!d) { return; } + if (d.closed) { + return void orderClosed.push(id); + } + if (d.lastAdmin /* && !d.closed */) { + return void orderAnswered.push(id); + } + if (d.premium /* && !d.lastAdmin && !d.closed */) { + return void orderPremium.push(id); + } + orderNormal.push(id); + //if (!d.premium && !d.lastAdmin && !d.closed) { return void orderNormal.push(id); } + }); + var cols = [$col1, $col2, $col3, $col4]; [orderPremium, orderNormal, orderAnswered, orderClosed].forEach(function (list, j) { + list.sort(sort); list.forEach(function (id, i) { var $t = $div.find('[data-id="'+id+'"]'); var d = getTicketData(id);