adizafri2000 / billscraper

Sample headless automation project to scrape bills, calculate monthly bill (rent + utilities) and generate a text message which is later sent to desired whatsapp recipients.
1 stars 0 forks source link

Database table updates on inactive (completed) installments #16

Closed adizafri2000 closed 9 months ago

adizafri2000 commented 10 months ago

When the automation executes, it should check whether the installment is going to be paid for its last month on the current run. If yes, after calculation or anywhere suitable, update the row of the installment to have its is_active column set to FALSE.

Suggested algo:

  1. Retrieve all active installments.
  2. Calculate projected end date/month by start_date + period.
  3. If the result in 2 in falls in the current month, update the installment's record by setting the is_active column to FALSE.
adizafri2000 commented 9 months ago

Sample installment data added for testing (id=2)

image
adizafri2000 commented 9 months ago

For detecting whether the installment should be closed, the fix passes these test cases:

  1. Installment should be closed if today's date is greater than or equal to start_date + period
  1. Installment should not be closed if today's date is before start_date + period
adizafri2000 commented 9 months ago

Fixes done, tested and working on dev actions