-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Labels
Description
- What are we trying to do?
- Create a boolean configuration option like "Appointment Date Budget Bar"
- Tie that config option into the budget bar calculations, so when true the calculations are considering the Appointment Date rather than the Pledged Date.
-
What feature or behavior is this required for?
At least one of our funds does their budgetting based on what date the appointment is planned for, rather than when they are making the pledge for the patient. They asked us for this to help their at-a-glance in Daria to be reliable for them! -
How could we solve this issue?
There are two main steps:-
Create the configuration option.
- It should look a lot like the config half of Add optional practical_support_waiver field to patient behind a Config #3259
-
Tie the config into the existing logic.
- currently the logic for which window of pledges to consider happens in the
Patientmodel'spledged_status_summaryfunction:
dcaf_case_management/app/models/patient.rb
Lines 96 to 99 in 40910cc
patients = base.where(pledge_sent_at: start_of_period..) .or(base.where(fund_pledged_at: start_of_period..)) .order(fund_pledged_at: :asc) .select(*plucked_attrs) - this could be straightforward, or possibly benefit from a small refactor to isolate the date choice logic!
- The BudgetBarCalculable Concern and BudgetBarHelper have some additional context for understanding the whole logic.
- We will definitely want tests around this new and old behavior!
- currently the logic for which window of pledges to consider happens in the
-
-
Anything else?
Change welcome as a single PR or two!