Class: NextSgad::Result

Inherits:
ApplicationRecord show all
Defined in:
app/models/next_sgad/result.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#create_number, #create_number!

Instance Method Details

#change_statusObject



20
21
22
23
# File 'app/models/next_sgad/result.rb', line 20

def change_status
  self.state = self.result_valid? ? 1 : 0
  self.save
end

#increase_amountObject

enum result_type: NextSgad::Goal.goal_types



14
15
16
17
18
# File 'app/models/next_sgad/result.rb', line 14

def increase_amount
  employee_goal = self.employee_goal
  employee_goal.amount = employee_goal.amount + self.result_value
  employee_goal.save
end