Commit bba2b10e authored by Nihad Abbasov's avatar Nihad Abbasov

properly paginate project events in API

parent 7277280d
......@@ -95,10 +95,7 @@ module API
# Example Request:
# GET /projects/:id/events
get ":id/events" do
limit = (params[:per_page] || 20).to_i
offset = (params[:page] || 0).to_i * limit
events = user_project.events.recent.limit(limit).offset(offset)
events = paginate user_project.events.recent
present events, with: Entities::Event
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment