From 40a19424ca30105cabb2acb70ab9eb0915e88893 Mon Sep 17 00:00:00 2001 From: Holger Trampe Date: Fri, 22 Oct 2021 18:38:41 +0200 Subject: [PATCH] newuserdata --- api/views.py | 3 ++- .../__pycache__/counter_tag.cpython-38.pyc | Bin 28666 -> 28692 bytes standards/templatetags/counter_tag.py | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/api/views.py b/api/views.py index 51a9003..18065cf 100644 --- a/api/views.py +++ b/api/views.py @@ -235,7 +235,8 @@ def NCAddUser(request): "password": password, "displayName": displayName, "email":email, - "groups[]":groups + "groups[]":groups, + "quota": 104857600 } headers = { diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index 252a0f6b87b99d5a5a9d4b57e2618dd89b430a24..96a41b7bbb162c5dc8da2b6d19350b29c74baf11 100644 GIT binary patch delta 301 zcmex$pK;0qM&3|fUM>b8xbeIw(P|^_&UD5XlaHsz`_wR{@JKS$vZV0TvH~$%4ND4d zHcN3$4OI@7;Z-5TVWMBcZ zlz^FD%V3NlZyBNsKQ`%qdNc;ssM+ z(Rg2{qGgPeUuWscNdUDoFzGN!FiJ3SFtPxl03!z@7ZVq=3{%mr&3f6A%pA8^auZ83 KfIPpvHH-k};7b8nDe+Ok#{5S&UD5nlaHsz*OzdWa4+BiV%{326dp;26yAkQ z3mKakYgvF|d?~y&EDM=xSxfjKvNf#I3@LogOtow&{3Tovv1UeT1|XXmq`R3>grSxl zsunC#A^_COp2E}2)Xca*Fhw9ma3NEPKn)v^Cj?}3GlI0Gvjj6}3T@t!QN}36z{0># z^cLvSqF_cKu@XeY1G$>Qll`)S3HTa1~v7z>IT7$*P8(iIZ`YG7c}VUl2!V3K0wVG?4NVJSMW**#m5nWJbY$n*n@ Oll8g9H#g)>VFUmRsZTZl diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index bb7ac13..1500a18 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -1203,16 +1203,18 @@ def getUserQuotaData(userdata): quotadata = [int(s) for s in re.findall('(.+?)', r.text)] inuse = [int(s) for s in re.findall('(.+?)', r.text)] - - i = int(math.floor(math.log(quotadata[0], 1024))) - p = math.pow(1024, i) - # s for textlabel - s = round(quotadata[0] / p, 2) + quotadata_value = quotadata[0] + valuequota_MB = 0 + counter = 0 + while(quotadata_value > 9999 or counter > 3): + quotadata_value = quotadata_value / 1024 + counter += 1 + + valuequota_MB = round(quotadata_value, 0) + # PERCENT percent = (100 / int(quotadata[0]))*int(inuse[0]) - # TODO: Hier werden GB nicht korrekt umgerechnet in MB - - return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(s).split(".")[0]] + return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(valuequota_MB).split(".")[0]]