mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-01 00:29:03 +02:00
fix(core): fixed user ratio showed in ranking list issues
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
angular.module('core')
|
||||
.directive('scoreLevel', scoreLevel);
|
||||
|
||||
function scoreLevel() {
|
||||
scoreLevel.$reject = ['ScoreLevelService'];
|
||||
|
||||
function scoreLevel(ScoreLevelService) {
|
||||
var directive = {
|
||||
restrict: 'A',
|
||||
replace: true,
|
||||
@@ -14,12 +16,17 @@
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs) {
|
||||
scope.$watch(attrs.scoreLevel, function (level) {
|
||||
var l = 'L' + (level ? level : 0);
|
||||
l = '<kbd>' + l + '</kbd>';
|
||||
scope.$watch(attrs.scoreLevel, function (u) {
|
||||
if (u) {
|
||||
console.log(u);
|
||||
var scoreLevelData = ScoreLevelService.getScoreLevelJson(u.score);
|
||||
|
||||
element.addClass('score-level');
|
||||
element.html(l);
|
||||
var l = 'L' + (scoreLevelData ? scoreLevelData.currLevel : 0);
|
||||
l = '<kbd>' + l + '</kbd>';
|
||||
|
||||
element.addClass('score-level');
|
||||
element.html(l);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
{{'PAGE_HEADER_RANKING_DOWNLOAD' | translate}}:
|
||||
</h4>
|
||||
</span>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-valign-middle">
|
||||
<thead>
|
||||
@@ -120,6 +121,7 @@
|
||||
{{'PAGE_HEADER_RANKING_RATIO' | translate}}:
|
||||
</h4>
|
||||
</span>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-valign-middle">
|
||||
<thead>
|
||||
@@ -170,6 +172,7 @@
|
||||
{{'PAGE_HEADER_RANKING_SCORE' | translate}}:
|
||||
</h4>
|
||||
</span>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-valign-middle">
|
||||
<thead>
|
||||
@@ -177,7 +180,7 @@
|
||||
<th class="text-center">#</th>
|
||||
<th class="text-center"></th>
|
||||
<th>{{ 'TABLE_FIELDS.USERNAME' | translate}}</th>
|
||||
<th class="text-center ranking-active-col">{{ 'TABLE_FIELDS.SCORE' | translate}}</th>
|
||||
<th class="text-right ranking-active-col">{{ 'TABLE_FIELDS.SCORE' | translate}}</th>
|
||||
<th class="text-center" ng-if="vm.announce.privateTorrentCmsMode">{{ 'TABLE_FIELDS.UPLOAD' | translate}}</th>
|
||||
<th class="text-center" ng-if="vm.announce.privateTorrentCmsMode">{{ 'TABLE_FIELDS.DOWNLOAD' | translate}}</th>
|
||||
<th class="text-center" ng-if="vm.announce.privateTorrentCmsMode">{{ 'TABLE_FIELDS.RATIO' | translate}}</th>
|
||||
@@ -197,7 +200,7 @@
|
||||
<span vip-flag="user"></span>
|
||||
<!--<span message-to="user" to-class="message-to-icon"></span>-->
|
||||
</td>
|
||||
<td class="text-center ranking-active-col">{{user.score}}</td>
|
||||
<td class="text-right ranking-active-col">{{user.score}} <span score-level="user"></span></td>
|
||||
<td class="text-center" ng-if="vm.announce.privateTorrentCmsMode">{{user.uploaded | bytes:2}}</td>
|
||||
<td class="text-center" ng-if="vm.announce.privateTorrentCmsMode">{{user.downloaded | bytes:2}}</td>
|
||||
<td class="text-center" ng-if="vm.announce.privateTorrentCmsMode"><span
|
||||
|
||||
@@ -15,7 +15,7 @@ var path = require('path'),
|
||||
exports.list = function (req, res) {
|
||||
var findUploadRanking = function (callback) {
|
||||
User.find({status: 'normal'}, '-salt -password -providerData')
|
||||
.sort('-uploaded')
|
||||
.sort('-uploaded -downloaded -ratio -score')
|
||||
.limit(20)
|
||||
.exec(function (err, users) {
|
||||
if (err) {
|
||||
@@ -28,7 +28,7 @@ exports.list = function (req, res) {
|
||||
|
||||
var findDownloadRanking = function (callback) {
|
||||
User.find({status: 'normal'}, '-salt -password -providerData')
|
||||
.sort('-downloaded')
|
||||
.sort('-downloaded -uploaded -ratio -score')
|
||||
.limit(20)
|
||||
.exec(function (err, users) {
|
||||
if (err) {
|
||||
@@ -41,7 +41,7 @@ exports.list = function (req, res) {
|
||||
|
||||
var findScoreRanking = function (callback) {
|
||||
User.find({status: 'normal'}, '-salt -password -providerData')
|
||||
.sort('-score')
|
||||
.sort('-score -uploaded -downloaded -ratio')
|
||||
.limit(20)
|
||||
.exec(function (err, users) {
|
||||
if (err) {
|
||||
@@ -54,13 +54,25 @@ exports.list = function (req, res) {
|
||||
|
||||
var findRatioRanking = function (callback) {
|
||||
User.find({status: 'normal'}, '-salt -password -providerData')
|
||||
.sort('-ratio')
|
||||
.sort('-ratio -uploaded -downloaded -score')
|
||||
.limit(20)
|
||||
.exec(function (err, users) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, users);
|
||||
var ru = [];
|
||||
users.forEach(function (u) {
|
||||
if (u.ratio < 0) {
|
||||
ru.push(u);
|
||||
}
|
||||
});
|
||||
users.forEach(function (u) {
|
||||
if (u.ratio >= 0) {
|
||||
ru.push(u);
|
||||
}
|
||||
});
|
||||
|
||||
callback(null, ru);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user