Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
json format of timespent query
Browse files Browse the repository at this point in the history
  • Loading branch information
wuminzhe committed Mar 15, 2024
1 parent 7516e13 commit 6f540ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def message
end
end

# GET /messages/timespent/gt/30/minutes?status=accepted,root_ready
# GET /messages/timespent/lt/30/minutes.json?status=accepted,root_ready
def timespent
unit = params[:unit].singularize
if unit == 'second'
Expand Down Expand Up @@ -61,7 +63,10 @@ def timespent

status = params[:status] || 'accepted,root_ready,dispatch_success,dispatch_failed'
@messages = @messages.where(status: status.split(','))
render :index
respond_to do |format|
format.html { render :index }
format.json { render json: { messages: @messages, messages_count: @messages_count } }
end
end

private
Expand Down

0 comments on commit 6f540ca

Please sign in to comment.