mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-20 12:04:31 +08:00
Merge pull request #2560 from biosistemika/SCI-4601-fix-snapshot-bugs
SCI-4601 fix the associations, renaming variable
This commit is contained in:
commit
384b107c6c
4 changed files with 11 additions and 7 deletions
|
@ -4,7 +4,7 @@
|
||||||
var MyModuleRepositories = (function() {
|
var MyModuleRepositories = (function() {
|
||||||
const FULL_VIEW_MODAL = $('#myModuleRepositoryFullViewModal');
|
const FULL_VIEW_MODAL = $('#myModuleRepositoryFullViewModal');
|
||||||
const UPDATE_REPOSITORY_MODAL = $('#updateRepositoryRecordModal');
|
const UPDATE_REPOSITORY_MODAL = $('#updateRepositoryRecordModal');
|
||||||
const STATUS_POLLING_INTERVAL = 30000;
|
const STATUS_POLLING_INTERVAL = 10000;
|
||||||
var SIMPLE_TABLE;
|
var SIMPLE_TABLE;
|
||||||
var FULL_VIEW_TABLE;
|
var FULL_VIEW_TABLE;
|
||||||
var FULL_VIEW_TABLE_SCROLLBAR;
|
var FULL_VIEW_TABLE_SCROLLBAR;
|
||||||
|
|
|
@ -7,7 +7,7 @@ class RepositoryDateTimeRangeValueBase < ApplicationRecord
|
||||||
inverse_of: :created_repository_date_time_values
|
inverse_of: :created_repository_date_time_values
|
||||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id, class_name: 'User', optional: true,
|
belongs_to :last_modified_by, foreign_key: :last_modified_by_id, class_name: 'User', optional: true,
|
||||||
inverse_of: :modified_repository_date_time_values
|
inverse_of: :modified_repository_date_time_values
|
||||||
has_one :repository_cell, as: :value, dependent: :destroy, inverse_of: :repository_date_time_value
|
has_one :repository_cell, as: :value, dependent: :destroy, inverse_of: :value
|
||||||
accepts_nested_attributes_for :repository_cell
|
accepts_nested_attributes_for :repository_cell
|
||||||
|
|
||||||
validates :repository_cell, :start_time, :end_time, :type, presence: true
|
validates :repository_cell, :start_time, :end_time, :type, presence: true
|
||||||
|
|
|
@ -10,4 +10,8 @@ class RepositoryStatusItem < ApplicationRecord
|
||||||
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User', optional: true,
|
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User', optional: true,
|
||||||
inverse_of: :modified_repository_status_types
|
inverse_of: :modified_repository_status_types
|
||||||
has_many :repository_status_values, inverse_of: :repository_status_item, dependent: :destroy
|
has_many :repository_status_values, inverse_of: :repository_status_item, dependent: :destroy
|
||||||
|
|
||||||
|
def data
|
||||||
|
"#{icon} #{status}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,12 +31,12 @@ class RepositoryStatusValue < ApplicationRecord
|
||||||
|
|
||||||
def snapshot!(cell_snapshot)
|
def snapshot!(cell_snapshot)
|
||||||
value_snapshot = dup
|
value_snapshot = dup
|
||||||
list_item = cell_snapshot.repository_column
|
status_item = cell_snapshot.repository_column
|
||||||
.repository_status_items
|
.repository_status_items
|
||||||
.find { |item| item.data == repository_status_item.data }
|
.find { |item| item.data == repository_status_item.data }
|
||||||
value_snapshot.assign_attributes(
|
value_snapshot.assign_attributes(
|
||||||
repository_cell: cell_snapshot,
|
repository_cell: cell_snapshot,
|
||||||
repository_status_item: list_item,
|
repository_status_item: status_item,
|
||||||
created_at: created_at,
|
created_at: created_at,
|
||||||
updated_at: updated_at
|
updated_at: updated_at
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ class RepositoryStatusValue < ApplicationRecord
|
||||||
def data
|
def data
|
||||||
return nil unless repository_status_item
|
return nil unless repository_status_item
|
||||||
|
|
||||||
"#{repository_status_item.icon} #{repository_status_item.status}"
|
repository_status_item.data
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new_with_payload(payload, attributes)
|
def self.new_with_payload(payload, attributes)
|
||||||
|
|
Loading…
Add table
Reference in a new issue