Skip to content

Commit

Permalink
Improve if-else for update log persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMicroNova committed Dec 3, 2024
1 parent 83d3eb2 commit 7807bf6
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions amplipi/updater/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,18 @@ <h1><span class="text-white">Ampli</span><span class="text-danger">Pi</span></h1

async function log_update(){
let persist_data = await getPersist();
let persist_state = persist_data["persist_logs"]
if (!persist_state) {
await fetch("/settings/persist_logs", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
persist_logs: true,
auto_off_delay: 3, // Three days is an arbitrary number, picked to ensure the next few days of usage post-update are captured for support cases
}),
});
}
await fetch("/settings/persist_logs", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
persist_logs: true,
auto_off_delay: persist_data["persist_logs"] && persist_data["auto_off_delay"] > 3 ? persist_data["auto_off_delay"] : 3,
// Three days is an arbitrary number, picked to ensure the next few days of usage post-update are captured for support cases
// If persist logs is already on and has a larger delay, keep that delay; otherwise ensure it has our sane minimum for support
}),
});
}
</script>

Expand Down

0 comments on commit 7807bf6

Please sign in to comment.