fix quota comparison to compare in GB
+
import csv
import math
from django.core.management.base import BaseCommand
from django.core.exceptions import ValidationError
+
+from hs_core.hydroshare import convert_file_size_to_unit
from theme.models import UserQuota
from hs_core.hydroshare.resource import get_quota_usage_from_irods
@@ -18,6 +21,7 @@ class Command(BaseCommand):
user__is_active=True).filter(user__is_superuser=False):
try:
used_value = get_quota_usage_from_irods(uq.user.username)
+ used_value = convert_file_size_to_unit(used_value, "gb")
if not math.isclose(used_value, uq.used_value, abs_tol=0.1):
# report inconsistency
report_dict = {
@@ -28,6 +32,7 @@ class Command(BaseCommand):
print('quota incosistency: {} reported in django vs {} reported in iRODS for user {}'.format(
uq.used_value, used_value, uq.user.username), flush=True)
except ValidationError as ex:
+ if uq.used_value > 0.0:
print(ex, flush=True)
if quota_report_list:
