Skip to content

Conversation

johnpinto1
Copy link
Contributor

Organisation Plans and the related CSV Download".

**Changes:**
- where(Role.creator_condition) condition added to Plans retrieved in the Org model's org_admin_plans method. This ensures that Plans returned are only active plans. Note: if an owner or co-owner de-activates a plan the Role of the user is set to active: false, so any plan with creator with role (having active: false) would mean the Plan is removed.
- To avoid duplication we removed .where(Role.creator_condition) in org_admin method in app/controllers/paginable/plans_controller.rb from line plans = plans.joins(:template, roles: [user::org]).where(Role.creator_condition).
- Updated RSpec tests for Org method org_admin_plans() in spec/models/org_spec.rb.
- Update CHANGELOG.

Under the current code an Org plan that is removed by owner or coowner will be visible by the Org admins for the Org in the CSV. The Org Admin, correctly, does not show plan. With this change in code the removed plan is no longer present in the CSV.
To test:
Look at a given removed plan before and after code change.

    Organisation Plans and the related CSV Download".

    Changes:
    - where(Role.creator_condition) condition added to Plans retrieved in
      the Org model's org_admin_plans method. This ensures that Plans
    returned are only active plans. Note: if an owner or co-owner
    de-activates a plan the Role of the user is set to active: false, so any
    plan with creator with role (having active: false) would mean the Plan
    is removed.
    - To avoid duplication we removed .where(Role.creator_condition) in
      org_admin method in app/controllers/paginable/plans_controller.rb from
      line
       plans = plans.joins(:template, roles: [user::org]).where(Role.creator_condition).
    - Updated RSpec tests for Org method org_admin_plans() in spec/models/org_spec.rb.
    - Update CHANGELOG.
@johnpinto1 johnpinto1 self-assigned this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant