From 29d6ab2c5f5089f7e3f6c0de67a0212eacbbd068 Mon Sep 17 00:00:00 2001 From: Koch Michael Date: Sun, 1 Jun 2014 22:16:13 +0200 Subject: Show correct Value for 'Traffic left' in Accounts View afaik all the traffic values are in KiB, so the byte-value it has to be multiplied by 1024 for the accounts View to show it correctly --- pyload/web/app/scripts/helpers/formatSize.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pyload/web/app/scripts') diff --git a/pyload/web/app/scripts/helpers/formatSize.js b/pyload/web/app/scripts/helpers/formatSize.js index f72d62158..ddd62a1a5 100644 --- a/pyload/web/app/scripts/helpers/formatSize.js +++ b/pyload/web/app/scripts/helpers/formatSize.js @@ -3,7 +3,11 @@ define('helpers/formatSize', ['handlebars', 'utils/i18n'], function(Handlebars, 'use strict'; var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']; - function formatSize(bytes, options) { + function formatSize(bytes, options, multiplier) { + //multiplier 1024 is used for trafficleft because trafficleft is in KiB + if (typeof multiplier === 'number') + bytes = bytes * multiplier; + if (!bytes || bytes === 0) return '0 B'; if (bytes === -1) return i18n.gettext('not available'); @@ -17,4 +21,4 @@ define('helpers/formatSize', ['handlebars', 'utils/i18n'], function(Handlebars, Handlebars.registerHelper('formatSize', formatSize); return formatSize; -}); \ No newline at end of file +}); -- cgit v1.2.3