Aggregate Unhealthy Plant Count
Not Started

User Story:
As a Garden Manager, I want the garden record to keep track of the number of unhealthy plants it has, so I can accurately report on and monitor the health status of my garden.

Acceptance Criteria:

  • The garden's "Total Unhealthy Plant Count" (CAMPX__Total_Unhealthy_Plant_Count__c) should count/sum the number of child plant records whose status is: Sick, Deceased, or Wilting
  • The field value must increase when a plant's status changes from healthy to unhealthy
  • The field value must decrease when a plant's status changes from unhealthy to healthy
  • The field value must decrease when a plant leaves the garden (if it's deleted or reparented)
  • The field value must increase when a sick plant enters the garden (if it's reparented)

Example Scenario:

  • A fern in the Tropical Garden is marked as wilting, resulting in the "Total Unhealthy Plant Count" for the Tropical Garden incrementing by one.
  • A sick orchid in the Orchid Garden is cured, and its status is updated to healthy, leading to a decrease in the "Unhealthy Plant Count" for the Orchid Garden.
  • A deceased sunflower in the Sunflower Garden is removed, causing the "Total Unhealthy Plant Count" for the Sunflower Garden to decrease by one.
  • A plant in the Herb Garden changes status from wilting to diseased, the "Total Unhealthy Plant Count" for the Herb Garden remains unchanged