fix(torrents): remove redundant string code

This commit is contained in:
OldHawk
2017-11-02 17:48:38 +08:00
parent fb48320b9c
commit cb9b77b832
4 changed files with 25 additions and 48 deletions

View File

@@ -69,13 +69,12 @@
* orderByVote
*/
vm.orderByVote = function () {
vm.sortSLF = undefined;
if (vm.sortVote === undefined) {
vm.sortVote = '-';
vm.sort = '-resource_detail_info.vote_average';
vm.sort = {'resource_detail_info.vote_average': -1};
} else if (vm.sortVote === '-') {
vm.sortVote = '+';
vm.sort = 'resource_detail_info.vote_average';
} else if (vm.sortVote === '+') {
vm.sortVote = undefined;
vm.sort = undefined;
}
@@ -87,33 +86,19 @@
* orderBySLF
*/
vm.orderBySLF = function () {
vm.sortVote = undefined;
if (vm.sortSLF === undefined) {
vm.sortSLF = '-S';
vm.sortSLFString = $translate.instant('TABLE_FIELDS.SORT_S');
vm.sort = '-torrent_seeds';
vm.sort = {torrent_seeds: -1};
} else if (vm.sortSLF === '-S') {
vm.sortSLF = '+S';
vm.sortSLFString = $translate.instant('TABLE_FIELDS.SORT_S');
vm.sort = 'torrent_seeds';
} else if (vm.sortSLF === '+S') {
vm.sortSLF = '-L';
vm.sortSLFString = $translate.instant('TABLE_FIELDS.SORT_L');
vm.sort = '-torrent_leechers';
vm.sort = {torrent_leechers: -1};
} else if (vm.sortSLF === '-L') {
vm.sortSLF = '+L';
vm.sortSLFString = $translate.instant('TABLE_FIELDS.SORT_L');
vm.sort = 'torrent_leechers';
} else if (vm.sortSLF === '+L') {
vm.sortSLF = '-F';
vm.sortSLFString = $translate.instant('TABLE_FIELDS.SORT_F');
vm.sort = '-torrent_finished';
vm.sort = {torrent_finished: -1};
} else if (vm.sortSLF === '-F') {
vm.sortSLF = '+F';
vm.sortSLFString = $translate.instant('TABLE_FIELDS.SORT_F');
vm.sort = 'torrent_finished';
} else if (vm.sortSLF === '+F') {
vm.sortSLF = undefined;
vm.sortSLFString = undefined;
vm.sort = undefined;
}