2014-09-02 18:07:02 +05:30
|
|
|
module Milestones
|
|
|
|
class UpdateService < Milestones::BaseService
|
|
|
|
def execute(milestone)
|
|
|
|
state = params[:state_event]
|
|
|
|
|
|
|
|
case state
|
|
|
|
when 'activate'
|
2017-09-10 17:25:29 +05:30
|
|
|
Milestones::ReopenService.new(parent, current_user, {}).execute(milestone)
|
2014-09-02 18:07:02 +05:30
|
|
|
when 'close'
|
2017-09-10 17:25:29 +05:30
|
|
|
Milestones::CloseService.new(parent, current_user, {}).execute(milestone)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
if params.present?
|
|
|
|
milestone.update_attributes(params.except(:state_event))
|
|
|
|
end
|
|
|
|
|
|
|
|
milestone
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|