Skip to content

Commit

Permalink
bug fix for api v0
Browse files Browse the repository at this point in the history
  • Loading branch information
briri committed Jan 5, 2021
1 parent 20f63e8 commit 9863cf5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/controllers/api/v0/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class Api::V0::PlansController < Api::V0::BaseController

include Paginable

before_action :authenticate

##
Expand Down Expand Up @@ -92,7 +94,8 @@ def index
plan_ids = extract_param_list(params, "plan")
@plans = @plans.where(id: plan_ids) if plan_ids.present?
# apply pagination after filtering
@plans = paginate @plans
@args = { per_page: params[:per_page], page: params[:page] }
@plans = refine_query(@plans)
respond_with @plans
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/v0/plans/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ json.array! @plans.each do |plan|
data_contact = plan.contributors.data_curation.first
json.name data_contact.name
json.email data_contact.email
json.phone data_contact.phones
json.phone data_contact.phone
end
json.users plan.roles.each do |role|
json.email role.user.email
Expand Down

0 comments on commit 9863cf5

Please sign in to comment.