Skip to content

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

@lomky

Description

@lomky
  • 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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions