From 8f6fbc9b433f27b9d67b09e2a08a8316c7962292 Mon Sep 17 00:00:00 2001 From: Divyansh Agarwal Date: Mon, 4 Sep 2023 23:53:06 +0530 Subject: [PATCH 1/4] Set default value for storage limit slider --- .../assets/src/views/DeviceSettingsPage/index.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue index 12ccdf4940a..30b2efa10b6 100644 --- a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue +++ b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue @@ -560,7 +560,7 @@ }, created() { this.setDeviceURLs(); - this.setFreeSpace(); + if (this.freeSpace === 0) this.setFreeSpace(); }, beforeMount() { this.getDeviceSettings() @@ -635,7 +635,17 @@ } this.allowLearnerDownloadResources = allow_learner_download_resources; this.enableAutomaticDownload = enable_automatic_download; - this.limitForAutodownload = limit_for_autodownload.toString(); + if (set_limit_for_autodownload === false) { + if (this.freeSpace === 0) { + this.setFreeSpace().then(() => { + this.limitForAutodownload = (this.freeSpace * 0.8).toString(); + }); + } else { + this.limitForAutodownload = (this.freeSpace * 0.8).toString(); + } + } else { + this.limitForAutodownload = limit_for_autodownload.toString(); + } this.setLimitForAutodownload = set_limit_for_autodownload; }, getContentSettings() { From 73b6d2e48d4009f0447209857bddd9abe61aacd8 Mon Sep 17 00:00:00 2001 From: Divyansh Agarwal Date: Wed, 6 Sep 2023 19:37:50 +0530 Subject: [PATCH 2/4] Round the default value to integer --- .../device/assets/src/views/DeviceSettingsPage/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue index 30b2efa10b6..b262e0e2a70 100644 --- a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue +++ b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue @@ -638,10 +638,10 @@ if (set_limit_for_autodownload === false) { if (this.freeSpace === 0) { this.setFreeSpace().then(() => { - this.limitForAutodownload = (this.freeSpace * 0.8).toString(); + this.limitForAutodownload = parseInt(this.freeSpace * 0.8).toString(); }); } else { - this.limitForAutodownload = (this.freeSpace * 0.8).toString(); + this.limitForAutodownload = parseInt(this.freeSpace * 0.8).toString(); } } else { this.limitForAutodownload = limit_for_autodownload.toString(); From cfbf817256c97d2e2b3fac1c1df8f4e27be5f3f9 Mon Sep 17 00:00:00 2001 From: Divyansh Agarwal Date: Fri, 22 Sep 2023 00:01:21 +0530 Subject: [PATCH 3/4] Change the initial condition from null to 0 --- .../device/assets/src/views/DeviceSettingsPage/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue index 614aaa1aadf..43a5a56b0ce 100644 --- a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue +++ b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue @@ -441,7 +441,7 @@ allowLearnerDownloadResources: null, setLimitForAutodownload: null, limitForAutodownload: '0', - freeSpace: 0, + freeSpace: null, deviceUrls: [], showChangePrimaryLocationModal: false, showAddStorageLocationModal: false, @@ -565,7 +565,7 @@ }, created() { this.setDeviceURLs(); - if (this.freeSpace === 0) this.setFreeSpace(); + if (this.freeSpace === null) this.setFreeSpace(); }, beforeMount() { this.getDeviceSettings() From cb2d9ddd92c3c6950eeee5d0347199c6a7007163 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Mon, 25 Sep 2023 12:24:09 -0700 Subject: [PATCH 4/4] Check for null rather than 0 for unset value. --- .../device/assets/src/views/DeviceSettingsPage/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue index 43a5a56b0ce..8c3c3069a6f 100644 --- a/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue +++ b/kolibri/plugins/device/assets/src/views/DeviceSettingsPage/index.vue @@ -641,7 +641,7 @@ this.allowLearnerDownloadResources = allow_learner_download_resources; this.enableAutomaticDownload = enable_automatic_download; if (set_limit_for_autodownload === false) { - if (this.freeSpace === 0) { + if (this.freeSpace === null) { this.setFreeSpace().then(() => { this.limitForAutodownload = parseInt(this.freeSpace * 0.8).toString(); });