Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default value for storage limit slider #11191

Merged
merged 6 commits into from
Sep 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@
},
created() {
this.setDeviceURLs();
this.setFreeSpace();
if (this.freeSpace === 0) this.setFreeSpace();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine a situation where the freeSpace value is actually 0 - i.e. when there is no free space on the device. Perhaps it would be better if this were initialized as null rather than 0 to be able to do a check on whether it has been set or not (would have to make sure anywhere it was being used was being guarded against the non-numeric value).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the changes

},
beforeMount() {
this.getDeviceSettings()
Expand Down Expand Up @@ -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) {
rtibbles marked this conversation as resolved.
Show resolved Hide resolved
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() {
Expand Down