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

Allow budget bar to base its pledged amounts on Appointment Date #3335

Open
lomky opened this issue Jan 5, 2025 · 0 comments
Open

Allow budget bar to base its pledged amounts on Appointment Date #3335

lomky opened this issue Jan 5, 2025 · 0 comments

Comments

@lomky
Copy link
Member

lomky commented Jan 5, 2025

  • What are we trying to do?
  1. Create a boolean configuration option like "Appointment Date Budget Bar"
  2. 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:

    1. Create the configuration option.

    2. Tie the config into the existing logic.

      • currently the logic for which window of pledges to consider happens in the Patient model's pledged_status_summary function:
        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!
  • Anything else?
    Change welcome as a single PR or two!

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

No branches or pull requests

1 participant