Add the Popularity metric

PR #20180.
This commit is contained in:
Aliaksei Urbanski 2024-04-01 21:23:08 +03:00 committed by GitHub
parent 8e6515be2c
commit f37d0c486c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 93 additions and 0 deletions

View file

@ -926,6 +926,7 @@ window.qBittorrent.DynamicTable = (function() {
this.newColumn('upspeed', '', 'QBT_TR(Up Speed)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('popularity', '', 'QBT_TR(Popularity)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('tags', '', 'QBT_TR(Tags)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('added_on', '', 'QBT_TR(Added On)QBT_TR[CONTEXT=TransferListModel]', 100, true);
@ -1228,6 +1229,14 @@ window.qBittorrent.DynamicTable = (function() {
td.set('title', string);
};
// popularity
this.columns['popularity'].updateTd = function(td, row) {
const value = this.getRowValue(row);
const popularity = (value === -1) ? '∞' : window.qBittorrent.Misc.toFixedPointString(value, 2);
td.set('text', popularity);
td.set('title', popularity);
};
// added on
this.columns['added_on'].updateTd = function(td, row) {
const date = new Date(this.getRowValue(row) * 1000).toLocaleString();