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

Issue: repetition does not happen directly for past bills #22

Closed
Nadeige opened this issue Nov 28, 2020 · 7 comments
Closed

Issue: repetition does not happen directly for past bills #22

Nadeige opened this issue Nov 28, 2020 · 7 comments

Comments

@Nadeige
Copy link

Nadeige commented Nov 28, 2020

Thank for this app. It's very useful.

I have an issue with the repeat feature. Repeated bills only appear once, they are not repeated. Tested with weekly and monthly repetition. No error in Nextcloud log

Nextcloud server 20.0.2 (on Debian)
Cospend 1.2.2
PHP7.4
browser firefox 83.0

@julien-nc
Copy link
Owner

Thanks for the compliment!

Bill repetition is done by a background job launched when Nextcloud cron script runs. It's set to run once a day to repeat what needs to be.

What did you choose in Administration -> Basic settings -> Background jobs? If you are using AJAX or Webcron, it's possible the background jobs are delayed because those methods don't trigger anything if there is no user activity. It's recommended to choose "Cron" there and set a system cron job to execute the cron.php script every 15min or half hour.

Did you expect the repetition to happen directly when you created a bill with a date in the past? It's not the case, repetitions are only done by the background job.

@Nadeige
Copy link
Author

Nadeige commented Nov 29, 2020

This makes sense, thanks!

I'm using cron, with the cron.php file set to run every 5 minutes.
I was indeed expecting to see expenses on the statistics page for all repetitions of a bill set in the past.

I can see from nextcloud.oc_jobs that OCA\Cospend\Cron\RepeatBills was last ran 18 hours ago, which is before I created my recurring bill. If I understood what you said, it should run in about 6 hours then and create all expenses linked to the repeated bills.

It might be useful to add an option to force the cron job to run earlier in the case of creation of a past bill, and/or to warn users of the expected behavior.

@Nadeige Nadeige changed the title Issue: repeat does not work Issue: repetition does not happen directly for past bills Nov 29, 2020
@julien-nc
Copy link
Owner

julien-nc commented Nov 29, 2020

I'm interested to know if everything was actually correctly repeated after 24 hours.

It might be useful to add an option to force the cron job to run earlier in the case of creation of a past bill,

It is actually not so simple to make it right. What if you made a mistake and a lot of bills are created? Then you have to delete them'all 😁. A solution could be to have a button to "repeat now" in the bill edition form..but then it's one more thing to explain in the interface. What do you think?

and/or to warn users of the expected behavior.

Right, I added a hint next to the "repeat" select explaining when/how repetition happens.

@Nadeige
Copy link
Author

Nadeige commented Nov 29, 2020

I'm interested to know if everything was actually correctly repeated after 24 hours.

Yes it did! All the payments now appear in the bill list and in the statistics.

A solution could be to have a button to "repeat now" in the bill edition form.

You could add a button to duplicate existing bills (and then just edit the date). And keep the repeat option for creating bills with dates in the future. I'm not sure if this is what you had in mind with the "repeat now" button but that would do the trick for me.

@julien-nc
Copy link
Owner

You could add a button to duplicate existing bills (and then just edit the date)

Well it's kind of redundant with the repeat feature.

I'm not sure if this is what you had in mind with the "repeat now" button

It would be a button to immediately trigger the repetition process on one specific bill. This way, if you create a 10 days old bill, set it to daily repetition, you could just click the "repeat now" button to immediately create 9 repetitions of this bill until today. This would avoid waiting for the repetition job if you're in a hurry to see those bills created 😁.

julien-nc pushed a commit that referenced this issue Dec 9, 2020
@julien-nc
Copy link
Owner

v1.2.4 is out with the 'repeat now' button. I'm interested in your feedback if you have a chance to try this.

@Nadeige
Copy link
Author

Nadeige commented Dec 19, 2020

Hi, I just tested it. It seems to work perfectly. Thank you!

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

No branches or pull requests

2 participants