Skip to content

Commit

Permalink
switch to decimal storage sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Nov 1, 2023
1 parent 7e8dee2 commit 9481388
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/components/drive/DriveTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ module.exports = {
return formatted;
},
convertBytesToHumanReadable:function(bytes) {
if (bytes < 1024)
if (bytes < 1000)
return bytes + " Bytes";
if (bytes < 1024 * 1024)
return this.roundToDisplay(bytes / 1024) + " KiB";
if (bytes < 1024 * 1024 * 1024)
return this.roundToDisplay(bytes / 1024 / 1024) + " MiB";
return this.roundToDisplay(bytes / 1024 / 1024 / 1024) + " GiB";
if (bytes < 1000 * 1000)
return this.roundToDisplay(bytes / 1000) + " KB";
if (bytes < 1000 * 1000 * 1000)
return this.roundToDisplay(bytes / 1000 / 1000) + " MB";
return this.roundToDisplay(bytes / 1000 / 1000 / 1000) + " GB";
},
roundToDisplay:function(x) {
return Math.round(x * 100) / 100;
Expand Down
12 changes: 6 additions & 6 deletions src/components/modal/ModalPro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,22 @@ module.exports = {
]),
isPaid() {
return this.quotaBytes/(1024*1024) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() > 0;
return this.quotaBytes/(1000*1000) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() > 0;
},
isPro() {
return this.quotaBytes/(1024*1024) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.proMb;
return this.quotaBytes/(1000*1000) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.proMb;
},
isVisionary() {
return this.quotaBytes/(1024*1024) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.visionaryMb;
return this.quotaBytes/(1000*1000) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.visionaryMb;
},
isPioneer() {
return this.quotaBytes/(1024*1024) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.pioneerMb;
return this.quotaBytes/(1000*1000) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.pioneerMb;
},
isTrailBlazer() {
return this.quotaBytes/(1024*1024) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.trailblazerMb;
return this.quotaBytes/(1000*1000) > this.paymentProperties.freeMb() && this.paymentProperties.desiredMb() == this.trailblazerMb;
},
prorataTextVisionary() {
Expand Down Expand Up @@ -210,7 +210,7 @@ module.exports = {
},
updateCardDetails() {
this.updateCard(this.paymentProperties.desiredMb()*1024*1024)
this.updateCard(this.paymentProperties.desiredMb()*1000*1000)
},
updateCard(desired) {
Expand Down
14 changes: 7 additions & 7 deletions src/mixins/storage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module.exports = {

convertBytesToHumanReadable:function(bytesAsString) {
let bytes = Number(bytesAsString);
if (bytes < 1024)
if (bytes < 1000)
return bytes + " Bytes";
if (bytes < 1024 * 1024)
return this.roundToDisplay(bytes / 1024) + " KiB";
if (bytes < 1024 * 1024 * 1024)
return this.roundToDisplay(bytes / 1024 / 1024) + " MiB";
return this.roundToDisplay(bytes / 1024 / 1024 / 1024) + " GiB";
if (bytes < 1000 * 100)
return this.roundToDisplay(bytes / 1000) + " KB";
if (bytes < 1000 * 1000 * 1000)
return this.roundToDisplay(bytes / 1000 / 1000) + " MB";
return this.roundToDisplay(bytes / 1000 / 1000 / 1000) + " GB";
},
}
}

0 comments on commit 9481388

Please sign in to comment.