From d063e521baae09f652f8807da6abe06f5edc2a77 Mon Sep 17 00:00:00 2001 From: mike seibel Date: Wed, 21 Aug 2024 10:01:47 -0700 Subject: [PATCH 1/4] clean up capacity rounding --- endorsement/static/endorsement/js/handlebars-helpers.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/endorsement/static/endorsement/js/handlebars-helpers.js b/endorsement/static/endorsement/js/handlebars-helpers.js index 2750a186..f62b4576 100644 --- a/endorsement/static/endorsement/js/handlebars-helpers.js +++ b/endorsement/static/endorsement/js/handlebars-helpers.js @@ -39,7 +39,11 @@ $(window.document).ready(function() { 'or': function(a, b) { return (a || b); }, '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().substring(0,3) + 'MB' : (n >= 1000) ? (n/1000) + 'TB' : ((n < 100) ? n.toString().substring(0, (n < 10) ? 4 : 3) : Math.round(n)) + 'GB'; } - + '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'; + } }); }); From 4e5822493c165e886a39f5eb14085c2afa13b363 Mon Sep 17 00:00:00 2001 From: mike seibel Date: Wed, 21 Aug 2024 16:18:39 -0700 Subject: [PATCH 2/4] log drive with subscription with no current quota --- endorsement/dao/shared_drive.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/endorsement/dao/shared_drive.py b/endorsement/dao/shared_drive.py index d1c02125..cfbc7b69 100644 --- a/endorsement/dao/shared_drive.py +++ b/endorsement/dao/shared_drive.py @@ -338,6 +338,13 @@ def reconcile_drive_quota( sdr, no_subscription_quota=no_subscription_quota ) + if not quota_correct: + logger.info( + f"reconcile: skip set drive for {sdr.shared_drive.drive_id} " + "as the subscription contains no current quota" + ) + return + if quota_actual != quota_correct: # temporary check for prior to ITBill subscription deadline in_grace_period = ( From 2b8b4f291f2bcaa6e6abb0d4a75502a38c962677 Mon Sep 17 00:00:00 2001 From: mike seibel Date: Wed, 21 Aug 2024 16:35:00 -0700 Subject: [PATCH 3/4] improved drive size rounding --- endorsement/static/endorsement/js/handlebars-helpers.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/endorsement/static/endorsement/js/handlebars-helpers.js b/endorsement/static/endorsement/js/handlebars-helpers.js index f62b4576..cfa9ebb6 100644 --- a/endorsement/static/endorsement/js/handlebars-helpers.js +++ b/endorsement/static/endorsement/js/handlebars-helpers.js @@ -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'; } }); }); From 2072d01b9c0622c3d5ee2cfb54b39e8b1c93ad83 Mon Sep 17 00:00:00 2001 From: mike seibel Date: Wed, 21 Aug 2024 17:36:21 -0700 Subject: [PATCH 4/4] quota display --- .../static/endorsement/js/handlebars-helpers.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/endorsement/static/endorsement/js/handlebars-helpers.js b/endorsement/static/endorsement/js/handlebars-helpers.js index cfa9ebb6..346c7c3d 100644 --- a/endorsement/static/endorsement/js/handlebars-helpers.js +++ b/endorsement/static/endorsement/js/handlebars-helpers.js @@ -40,11 +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) + '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'; + 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'; } }); });