Skip to content

Commit

Permalink
chore: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MounirDhahri committed Jun 26, 2024
1 parent 71a8f53 commit 02822f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def index

# Return x-total-count header if total_count param is present. Keep this last
if params[:total_count].present?
headers["X-Total-Count"] = Submission.count
headers["X-Total-Count"] = submissions.count
end

render json: submissions.to_json, status: :ok
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/api/submissions/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
Fabricate(:submission, user: user, state: "draft")
Fabricate(:submission, user: user, state: "approved")

get "/api/submissions?total_count=true&size=1", headers: headers
get "/api/submissions?total_count=true&size=10", headers: headers
expect(response.status).to eq 200
body = JSON.parse(response.body)
expect(body.length).to eq 1
expect(body.length).to eq 3
expect(response.headers["X-Total-Count"]).to eq 3
end

Expand Down

0 comments on commit 02822f1

Please sign in to comment.