Explorar el Código

修正已使用空間的計算方式

osbert hace 4 años
padre
commit
d7aa4e4d5f
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      TEAMModelOS/Controllers/School/SchoolController.cs

+ 3 - 1
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -37,6 +37,8 @@ namespace TEAMModelOS.Controllers
         private readonly DingDing _dingDing;
         private readonly Option _option;
         int baseSpaceSize = 1; //學校保底空間大小(1G)
+        private readonly double bytes = 1073741824;
+
         public SchoolController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option)
         {
             _azureCosmos = azureCosmos;
@@ -1044,7 +1046,7 @@ namespace TEAMModelOS.Controllers
                         itemSize = itemSize != null ? itemSize : 0;
                         otherSize = otherSize != null ? otherSize : 0;
                         studentSize = studentSize != null ? studentSize : 0;
-                        usedSpace = Convert.ToInt32(Math.Ceiling((double)((docSize + videoSize + imageSize + paperSize + itemSize + otherSize + studentSize) / 1073741824)));
+                        usedSpace = Convert.ToInt32(Math.Ceiling((double)((docSize + videoSize + imageSize + paperSize + itemSize + otherSize + studentSize) / bytes)));
                         teacherSpace = avaliable - usedSpace;
                     }
                 }