mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 23:54:43 +08:00
Fix snapshot creator at locking task [SCI-11515]
This commit is contained in:
parent
f30844be6d
commit
14a0aef43a
4 changed files with 7 additions and 5 deletions
|
@ -373,6 +373,8 @@ class MyModulesController < ApplicationController
|
||||||
|
|
||||||
def update_state
|
def update_state
|
||||||
old_status_id = @my_module.my_module_status_id
|
old_status_id = @my_module.my_module_status_id
|
||||||
|
@my_module.my_module_status_created_by = current_user
|
||||||
|
|
||||||
if @my_module.update(my_module_status_id: update_status_params[:status_id])
|
if @my_module.update(my_module_status_id: update_status_params[:status_id])
|
||||||
log_activity(:change_status_on_task_flow, @my_module, my_module_status_old: old_status_id,
|
log_activity(:change_status_on_task_flow, @my_module, my_module_status_old: old_status_id,
|
||||||
my_module_status_new: @my_module.my_module_status.id)
|
my_module_status_new: @my_module.my_module_status.id)
|
||||||
|
|
|
@ -14,7 +14,7 @@ class MyModule < ApplicationRecord
|
||||||
include Assignable
|
include Assignable
|
||||||
include Cloneable
|
include Cloneable
|
||||||
|
|
||||||
attr_accessor :transition_error_rollback
|
attr_accessor :transition_error_rollback, :my_module_status_created_by
|
||||||
|
|
||||||
enum state: Extends::TASKS_STATES
|
enum state: Extends::TASKS_STATES
|
||||||
enum provisioning_status: { done: 0, in_progress: 1, failed: 2 }
|
enum provisioning_status: { done: 0, in_progress: 1, failed: 2 }
|
||||||
|
@ -567,7 +567,7 @@ class MyModule < ApplicationRecord
|
||||||
|
|
||||||
if status_changing_direction == :forward
|
if status_changing_direction == :forward
|
||||||
my_module_status.my_module_status_consequences.each do |consequence|
|
my_module_status.my_module_status_consequences.each do |consequence|
|
||||||
consequence.before_forward_call(self)
|
consequence.before_forward_call(self, my_module_status_created_by)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ class MyModuleStatusConsequence < ApplicationRecord
|
||||||
|
|
||||||
def backward(my_module); end
|
def backward(my_module); end
|
||||||
|
|
||||||
def before_forward_call(my_module); end
|
def before_forward_call(my_module, user = nil); end
|
||||||
|
|
||||||
def runs_in_background?
|
def runs_in_background?
|
||||||
false
|
false
|
||||||
|
|
|
@ -6,9 +6,9 @@ module MyModuleStatusConsequences
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_forward_call(my_module)
|
def before_forward_call(my_module, created_by = nil)
|
||||||
my_module.assigned_repositories.each do |repository|
|
my_module.assigned_repositories.each do |repository|
|
||||||
::RepositorySnapshot.create_preliminary!(repository, my_module)
|
::RepositorySnapshot.create_preliminary!(repository, my_module, created_by)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue