diff --git a/app/controllers/heartbeat_controller.rb b/app/controllers/heartbeat_controller.rb --- a/app/controllers/heartbeat_controller.rb +++ b/app/controllers/heartbeat_controller.rb @@ -21,7 +21,22 @@ #end #HeartBeat.create(user_id: @user.id, ip_address: request.remote_ip, status: params[:status]) - render text: (GraderConfiguration['right.heartbeat_response'] || 'OK') + res = GraderConfiguration['right.heartbeat_response'] + res.strip! if res + full = GraderConfiguration['right.heartbeat_response_full'] + full.strip! if full + + if full and full != '' + l = Login.where(ip_address: request.remote_ip).last + @user = l.user + if @user.solve_all_available_problems? + render text: (full || 'OK') + else + render text: (res || 'OK') + end + else + render text: (GraderConfiguration['right.heartbeat_response'] || 'OK') + end end def index