roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Discrepancy in Org Admin view of the Organisation Plans and the related CSV Download

Open johnpinto1 opened this issue 3 months ago • 0 comments

There is a discrepancy in Org Admin view of the Organisation Plans and the related CSV Download. The CSV download shows de-activated plans whilst the view only displays active plans.

The code for both use the same method org_admin_plans in the Org model https://github.com/DMPRoadmap/roadmap/blob/bfbb5183a86d9db12edb0a46bde2b8620fddbaca/app/models/org.rb#L287-L302

The paginable method org_admin for Org Admin plans by including the filter condition where(Role.creator_condition) ensures the view for Org Admins and Super Admins only see active plans (as we set Role of the creator (owner or co-owner who removes plan) to active: false). https://github.com/DMPRoadmap/roadmap/blob/bfbb5183a86d9db12edb0a46bde2b8620fddbaca/app/controllers/paginable/plans_controller.rb#L40-L59

We think discrepancy between view and download data should be fixed in Org model's method org_admin_plans rather than having it done in the paginable method org_admin as the former method is used in several places:

app/models/plan.rb 172: plan_ids = user.org.org_admin_plans.where(complete: true).pluck(:id).uniq

app/controllers/paginable/plans_controller.rb 48: plans = @super_admin ? Plan.all : current_user.org.org_admin_plans

app/controllers/api/v0/plans_controller.rb 75: org_admin_plans = @user.org.org_admin_plans

app/controllers/org_admin/plans_controller.rb 23: current_user.org.org_admin_plans.page(1) 71: org.org_admin_plans.includes(template: :org).order(updated_at: :desc).each do |plan|

johnpinto1 avatar Sep 16 '25 09:09 johnpinto1