Skip to content

Added export every x days#256

Open
Apflkuacha wants to merge 4 commits into
tmo1:masterfrom
Apflkuacha:exportInterval
Open

Added export every x days#256
Apflkuacha wants to merge 4 commits into
tmo1:masterfrom
Apflkuacha:exportInterval

Conversation

@Apflkuacha
Copy link
Copy Markdown

I have added the possibility to export every x days, that fixes #219

@tmo1
Copy link
Copy Markdown
Owner

tmo1 commented May 12, 2025

Thanks! I'll take a look.

@tmo1
Copy link
Copy Markdown
Owner

tmo1 commented Jan 8, 2026

Sorry for forgetting about this.

IIUC, your code schedules exports on the next dayOfYear evenly divisible by exportIntervalDays. Wouldn't it be simpler from a code perspective as well as more intuitive from a user perspective to just schedule exports for now + exportIntervalDays?

simplified export time calculation
@Apflkuacha
Copy link
Copy Markdown
Author

I've updated the code how you suggested - is that what you ment?

@tmo1
Copy link
Copy Markdown
Owner

tmo1 commented Jan 9, 2026

Thanks! That is more or less what I meant, but the logic is still not quite correct. Say exportTime is 2:00 AM, and exportIntervalDays is 2. An export runs on Jan. 1 2:00 AM and finishes at 2:05. When scheduling the next export, the app will first note that export_time < now and will accordingly add 1 to the DAY_OF_MONTH. Then, since exportIntervalDays > 1, it will further add exportIntervalDays to the DAY_OF_MONTH, which will result in the next export being scheduled for Jan. 4, rather than Jan. 3.

Edit: I think the correct behavior would be achieved with exportTime.add(Calendar.DAY_OF_MONTH, exportIntervalDays - 1) rather than exportTime.add(Calendar.DAY_OF_MONTH, exportIntervalDays).

@Apflkuacha
Copy link
Copy Markdown
Author

Once more I updated the code as you suggested. The first version I have successfully tested on my device, but now I haven't find enough time to test the changes. So feel free to further adapt if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Auto export every 'x' days.

2 participants