mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-18 09:47:13 +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
|
||||
|
||||
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!
|
||||
end
|
||||
|
|
|
@ -94,7 +94,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
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() {
|
||||
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
|
||||
|
||||
before_save :ensure_default_name
|
||||
after_discard :delete_step_results
|
||||
after_discard do
|
||||
CleanupUserSettingsJob.perform_later('result_states', id)
|
||||
end
|
||||
|
@ -187,4 +188,8 @@ class Result < ApplicationRecord
|
|||
def ensure_default_name
|
||||
self.name = name.presence || I18n.t('my_modules.results.default_name')
|
||||
end
|
||||
|
||||
def delete_step_results
|
||||
step_results.destroy_all
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue