show onboarding page when currency is not set
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
class ChipsController < ApplicationController
|
||||
def index
|
||||
json_response Chip.where(enabled: true).order(:name).to_json(include: :base_chip_values)
|
||||
all_chips = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'US Dollar',
|
||||
symbol: '$',
|
||||
code: 'USD',
|
||||
prefixed: true
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Bosnian Convertible Mark',
|
||||
symbol: 'KM',
|
||||
code: 'BAM',
|
||||
prefixed: false
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Euro',
|
||||
symbol: '€',
|
||||
code: 'EUR',
|
||||
prefixed: false
|
||||
}
|
||||
]
|
||||
json_response all_chips
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -46,8 +46,7 @@ class HomiesController < ApplicationController
|
||||
params.require(:homie).permit(
|
||||
:name,
|
||||
:importance,
|
||||
:about,
|
||||
:chip_id
|
||||
:about
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
28
app/controllers/original_gangstas_controller.rb
Normal file
28
app/controllers/original_gangstas_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class OriginalGangstasController < ApplicationController
|
||||
def show
|
||||
if OriginalGangsta.count.zero?
|
||||
OriginalGangsta.create.save
|
||||
end
|
||||
|
||||
json_response OriginalGangsta.first
|
||||
end
|
||||
|
||||
def update
|
||||
if original_gangsta_params[:chip_scale].to_i.positive?
|
||||
OriginalGangsta.update(original_gangsta_params)
|
||||
json_response onboarded: true
|
||||
else
|
||||
error_response :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def original_gangsta_params
|
||||
params.require(:original_gangsta).permit :chip_name,
|
||||
:chip_code,
|
||||
:chip_symbol,
|
||||
:chip_scale,
|
||||
:chip_prefixed
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,6 @@
|
||||
class Homie < ApplicationRecord
|
||||
has_many :money_moves
|
||||
has_many :work
|
||||
belongs_to :chip
|
||||
|
||||
def self.info(importance)
|
||||
cash_totals = Homie.all.joins(:money_moves).group(:id).order(:id).sum(:amount)
|
||||
|
||||
3
app/models/original_gangsta.rb
Normal file
3
app/models/original_gangsta.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class OriginalGangsta < ApplicationRecord
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user