mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-21 11:17:09 +08:00
Merge pull request #8610 from aignatov-bio/ai-sci-12061-add-archived-results-to-unlinking
Fix linking for archived and deleted results [SCI-12061][SCI-12060]
This commit is contained in:
commit
2de9de69cd
3 changed files with 12 additions and 2 deletions
|
@ -41,7 +41,12 @@ class ResultsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def list
|
def list
|
||||||
@results = @my_module.results.active
|
if params[:with_linked_step_id].present?
|
||||||
|
step = @my_module.protocol.steps.find_by(id: params[:with_linked_step_id])
|
||||||
|
@results = @my_module.results.where(archived: false).or(@my_module.results.where(id: step.results.select(:id)))
|
||||||
|
else
|
||||||
|
@results = @my_module.results.active
|
||||||
|
end
|
||||||
|
|
||||||
update_and_apply_user_sort_preference!
|
update_and_apply_user_sort_preference!
|
||||||
end
|
end
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
resultsListUrl() {
|
resultsListUrl() {
|
||||||
return list_my_module_results_path({ my_module_id: this.step.attributes.my_module_id });
|
return list_my_module_results_path({ my_module_id: this.step.attributes.my_module_id, with_linked_step_id: this.step.id });
|
||||||
},
|
},
|
||||||
resultsPageUrl() {
|
resultsPageUrl() {
|
||||||
return my_module_results_path({ my_module_id: this.step.attributes.my_module_id });
|
return my_module_results_path({ my_module_id: this.step.attributes.my_module_id });
|
||||||
|
|
|
@ -39,6 +39,7 @@ class Result < ApplicationRecord
|
||||||
accepts_nested_attributes_for :tables
|
accepts_nested_attributes_for :tables
|
||||||
|
|
||||||
before_save :ensure_default_name
|
before_save :ensure_default_name
|
||||||
|
after_discard :delete_step_results
|
||||||
after_discard do
|
after_discard do
|
||||||
CleanupUserSettingsJob.perform_later('result_states', id)
|
CleanupUserSettingsJob.perform_later('result_states', id)
|
||||||
end
|
end
|
||||||
|
@ -187,4 +188,8 @@ class Result < ApplicationRecord
|
||||||
def ensure_default_name
|
def ensure_default_name
|
||||||
self.name = name.presence || I18n.t('my_modules.results.default_name')
|
self.name = name.presence || I18n.t('my_modules.results.default_name')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete_step_results
|
||||||
|
step_results.destroy_all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue