1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed: releases with unknown seeders show on the UI as - instead of 0 to be easier to distinguish.

This commit is contained in:
Taloth Saldono 2017-06-19 23:28:03 +02:00
parent 475c99d492
commit 63e0eba02f

View File

@ -5,8 +5,8 @@ module.exports = Backgrid.Cell.extend({
render : function() {
if (this.model.get('protocol') === 'torrent') {
var seeders = this.model.get('seeders') || 0;
var leechers = this.model.get('leechers') || 0;
var seeders = this.model.get('seeders');
var leechers = this.model.get('leechers');
var level = 'danger';
@ -18,7 +18,19 @@ module.exports = Backgrid.Cell.extend({
level = 'primary';
}
this.$el.html('<div class="label label-{2}" title="{0} seeders, {1} leechers">{0} / {1}</div>'.format(seeders, leechers, level));
var txtSeeders = seeders;
var txtLeechers = leechers;
if (typeof seeders === 'undefined') {
txtSeeders = 'unknown';
seeders = '-';
}
if (typeof leechers === 'undefined') {
txtLeechers = 'unknown';
leechers = '-';
}
this.$el.html('<div class="label label-{0}" title="{1} seeders, {2} leechers">{3} / {4}</div>'.format(level, txtSeeders, txtLeechers, seeders, leechers));
}
this.delegateEvents();