Show More
Commit Description:
add config for heartbeat response...
Commit Description:
add config for heartbeat response update heartbeat view
References:
File last commit:
Show/Diff file:
Action:
app/controllers/heartbeat_controller.rb | 31 lines | 951 B | text/x-ruby | RubyLexer |
add heart_beat
r533 class HeartbeatController < ApplicationController
more heart beat feature...
r534 before_filter :admin_authorization, :only => ['index']
add heart_beat
r533 def edit
@user = User.find_by_login(params[:id])
more heart beat feature...
r534 unless @user
render text: "LOGIN_NOT_FOUND"
return
end
keep all heartbeat instead of only the latest one
r537 #hb = HeartBeat.where(user_id: @user.id, ip_address: request.remote_ip).first
#puts "status = #{params[:status]}"
#if hb
# if params[:status]
# hb.status = params[:status]
# hb.save
# end
# hb.touch
#else
# HeartBeat.creae(user_id: @user.id, ip_address: request.remote_ip)
#end
HeartBeat.create(user_id: @user.id, ip_address: request.remote_ip, status: params[:status])
add config for heartbeat response...
r538
render text: (GraderConfiguration['right.heartbeat_response'] || 'OK')
more heart beat feature...
r534 end
def index
add config for heartbeat response...
r538 @hb = HeartBeat.where("updated_at >= ?",Time.zone.now-2.hours).includes(:user).order(:user_id).all
more heart beat feature...
r534 @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count
add heart_beat
r533 end
end