[sleeplog] Correct deleteBefore function ... last

pull/2679/head
Scharf 2023-04-05 23:13:34 +02:00
parent ce1c8b8ae8
commit d00cb89dea
2 changed files with 50 additions and 47 deletions

View File

@ -214,6 +214,9 @@ If you want to use other variables or functions from the trigger object inside t
### Worth Mentioning
---
#### To do list
- Optimize interface.html:
- Open logfile through require("Storage") instead of require("sleeplog").
- Give feedback how much files have been deleted on "delete all logfiles before".
- Check translations.
- Add more functionallities to interface.html.
- Enable receiving data on the Gadgetbridge side + testing.

View File

@ -104,7 +104,7 @@ function deleteBefore(dateString, callback) {
if (window.confirm("Do you really want to remove all data before " + date.toLocaleDateString(undefined))) {
Util.showModal("Deleting all data before" + date.toLocaleDateString(undefined) + " ...");
Puck.eval(`require("Storage").list(/^sleeplog_\\d+.log$/)` +
`.filter(file => (parseInt(file.match(/\\d+/)[0]) + 0.25) * 12096E5 < ` + date.valueOf() + `)` +
`.filter(file => (parseInt(file.match(/\\d+/)[0]) + 0.25) * 12096E5 < ` + date.valueOf() + ` - 12096E5)` +
`.map(file => require("Storage").erase(file)).length`, count => {
Util.hideModal();
window.alert(count + " files deleted");