mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-23 23:35:00 +08:00
Add methods for repository_date_time_value
This commit is contained in:
parent
2a20ad68a3
commit
aee806edaa
1 changed files with 11 additions and 0 deletions
|
@ -13,4 +13,15 @@ class RepositoryDateTimeValue < ApplicationRecord
|
|||
validates :repository_cell, :datetime_type, :start_time, presence: true
|
||||
validates :end_time, presence: true, if: ->(record) { record.datetime_type.to_s.include?('_range') }
|
||||
validates :end_time, absence: true, unless: ->(record) { record.datetime_type.to_s.include?('_range') }
|
||||
|
||||
SORTABLE_COLUMN_NAME = 'repository_date_time_values.start_time'
|
||||
SORTABLE_VALUE_INCLUDE = :repository_date_time_value
|
||||
|
||||
def formatted
|
||||
data
|
||||
end
|
||||
|
||||
def data
|
||||
[start_time, end_time].compact.join(' - ')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue