2016-05-24 16:39:39 +02:00
|
|
|
class AccompagnateurService
|
|
|
|
ASSIGN = 'assign'
|
|
|
|
NOT_ASSIGN = 'not_assign'
|
|
|
|
|
2016-10-07 12:10:58 +02:00
|
|
|
def initialize accompagnateur, procedure, to
|
|
|
|
@accompagnateur = accompagnateur
|
|
|
|
@procedure = procedure
|
|
|
|
@to = to
|
2016-05-24 16:39:39 +02:00
|
|
|
end
|
2016-09-08 16:21:54 +02:00
|
|
|
|
2016-10-07 12:10:58 +02:00
|
|
|
def change_assignement!
|
2017-04-05 10:22:37 +02:00
|
|
|
case @to
|
|
|
|
when ASSIGN
|
2016-10-07 12:10:58 +02:00
|
|
|
AssignTo.create(gestionnaire: @accompagnateur, procedure: @procedure)
|
2017-04-05 10:22:37 +02:00
|
|
|
when NOT_ASSIGN
|
2016-11-15 03:56:26 +01:00
|
|
|
AssignTo.where(gestionnaire: @accompagnateur, procedure: @procedure).delete_all
|
2016-10-07 12:10:58 +02:00
|
|
|
end
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|