Commit 0a6218fc authored by nazarf's avatar nazarf

change path to get and update miners

parent bf226b2c
...@@ -12,11 +12,12 @@ class FrontController < ApplicationController ...@@ -12,11 +12,12 @@ class FrontController < ApplicationController
def update_miner_activity def update_miner_activity
miner = Miner.find_by(name: params[:name]) miner = Miner.find_by(name: params[:name])
miner.update(status: 'work') miner.update(status: 'work')
render json: {status: 'ok'} render json: { status: 'ok' }
end end
def miners_activity def miners_activity
@data = Miner.all.map do |miner| miner = Miner.find_by(name: params[:name])
@data =
{ {
name: miner.name, name: miner.name,
status: miner.status, status: miner.status,
...@@ -33,10 +34,7 @@ class FrontController < ApplicationController ...@@ -33,10 +34,7 @@ class FrontController < ApplicationController
password_2: miner.password_2, password_2: miner.password_2,
algorithm_2: miner.algorithm_2 algorithm_2: miner.algorithm_2
} }
end
render json: @data render json: @data
end end
end end
...@@ -32,8 +32,8 @@ Rails.application.routes.draw do ...@@ -32,8 +32,8 @@ Rails.application.routes.draw do
get '/' => 'front#index' get '/' => 'front#index'
get 'pages/:id' => 'front#page', as: :front_page get 'pages/:id' => 'front#page', as: :front_page
get '/miners_activity', to: 'front#miners_activity', as: 'miners_activity' get '/miners_activity/:name', to: 'front#miners_activity', as: 'miners_activity'
get '/update_miner_activity', to: 'front#update_miner_activity', as: 'update_miner_activity' get '/update_miner_activity/:name', to: 'front#update_miner_activity', as: 'update_miner_activity'
root 'front#index' root 'front#index'
end 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