Skip to content

Commit

Permalink
improved drive size rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeseibel committed Aug 21, 2024
1 parent 4e58224 commit 2b8b4f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions endorsement/static/endorsement/js/handlebars-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ $(window.document).ready(function() {
'not': function(a) { return (!a); },
'numberFormat': function(n) { return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); },
'driveCapacity': function(n) {
return (n < 1) ? Math.round(n * 1000).toString().split('.')[0] + 'MB' :
(n < 100) ? Math.round(n).toString().substring(0,3) + 'GB' :
(n < 1000) ? Math.round(n).toString().split('.')[0] + 'GB' :
Math.round(n/1000).toString().split('.')[0] + 'TB';
return (n < 1) ? Math.round(n * 1000) + 'MB' :
(n < 10) ? n.toString().substring(0,3) + 'GB' :
(n < 1000) ? Math.round(n) + 'GB' :
(n < 10000) ? (n/1000).toString().substring(0,3) + 'TB' :
Math.round(n/1000) + 'TB';
}
});
});

0 comments on commit 2b8b4f2

Please sign in to comment.