mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
Merge branch 'develop'
This commit is contained in:
commit
73bebde3d9
7 changed files with 6 additions and 29 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.35.0
|
||||
1.35.0.1
|
||||
|
|
|
@ -121,7 +121,7 @@ class ResultsController < ApplicationController
|
|||
|
||||
def destroy
|
||||
name = @result.name
|
||||
if @result.discard
|
||||
if @result.destroy
|
||||
log_activity(:destroy_result, { destroyed_result: name })
|
||||
render json: {}, status: :ok
|
||||
else
|
||||
|
|
|
@ -56,7 +56,6 @@ class MyModule < ApplicationRecord
|
|||
belongs_to :changing_from_my_module_status, optional: true, class_name: 'MyModuleStatus'
|
||||
delegate :my_module_status_flow, to: :my_module_status, allow_nil: true
|
||||
has_many :results, inverse_of: :my_module, dependent: :destroy
|
||||
has_many :results_include_discarded, -> { with_discarded }, class_name: 'Result', inverse_of: :my_module
|
||||
has_many :my_module_tags, inverse_of: :my_module, dependent: :destroy
|
||||
has_many :tags, through: :my_module_tags, dependent: :destroy
|
||||
has_many :task_comments, foreign_key: :associated_id, dependent: :destroy
|
||||
|
|
|
@ -5,9 +5,6 @@ class Result < ApplicationRecord
|
|||
include SearchableModel
|
||||
include SearchableByNameModel
|
||||
include ViewableModel
|
||||
include Discard::Model
|
||||
|
||||
default_scope -> { kept }
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
validates :name, length: { maximum: Constants::NAME_MAX_LENGTH }
|
||||
|
|
|
@ -55,20 +55,9 @@ class ActivitiesService
|
|||
child_model = parent_model.reflect_on_association(child).class_name.to_sym
|
||||
next if subjects[child_model]
|
||||
|
||||
|
||||
if subject_name == 'Result'
|
||||
parent_model = parent_model.with_discarded
|
||||
end
|
||||
|
||||
if child == :results
|
||||
subjects[child_model] = parent_model.where(id: subjects[subject_name])
|
||||
.joins(:results_include_discarded)
|
||||
.pluck('results.id')
|
||||
else
|
||||
subjects[child_model] = parent_model.where(id: subjects[subject_name])
|
||||
.joins(child)
|
||||
.pluck("#{child.to_s.pluralize}.id")
|
||||
end
|
||||
subjects[child_model] = parent_model.where(id: subjects[subject_name])
|
||||
.joins(child)
|
||||
.pluck("#{child.to_s.pluralize}.id")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
class AddDiscardedAtToResults < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :results, :discarded_at, :datetime
|
||||
add_index :results, :discarded_at
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2024_04_29_070135) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2024_01_18_094253) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "btree_gist"
|
||||
enable_extension "pg_trgm"
|
||||
|
@ -984,12 +984,10 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_29_070135) do
|
|||
t.bigint "restored_by_id"
|
||||
t.datetime "restored_on", precision: nil
|
||||
t.integer "assets_view_mode", default: 0
|
||||
t.datetime "discarded_at"
|
||||
t.index "trim_html_tags((name)::text) gin_trgm_ops", name: "index_results_on_name", using: :gin
|
||||
t.index ["archived"], name: "index_results_on_archived"
|
||||
t.index ["archived_by_id"], name: "index_results_on_archived_by_id"
|
||||
t.index ["created_at"], name: "index_results_on_created_at"
|
||||
t.index ["discarded_at"], name: "index_results_on_discarded_at"
|
||||
t.index ["last_modified_by_id"], name: "index_results_on_last_modified_by_id"
|
||||
t.index ["my_module_id"], name: "index_results_on_my_module_id"
|
||||
t.index ["restored_by_id"], name: "index_results_on_restored_by_id"
|
||||
|
|
Loading…
Reference in a new issue