mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 05:18:01 +08:00
Merge pull request #4683 from G-Chubinidze/gc_SCI_7199
fixed id sorting on reports removed model duplicate code [SCI-7199]
This commit is contained in:
commit
bc43b3af98
5 changed files with 8 additions and 11 deletions
|
@ -41,6 +41,9 @@ class ReportDatatable < CustomDatatable
|
||||||
records.left_joins(:pdf_file_attachment)
|
records.left_joins(:pdf_file_attachment)
|
||||||
.order(active_storage_attachments: sort_direction(order_params))
|
.order(active_storage_attachments: sort_direction(order_params))
|
||||||
.order(pdf_file_status: sort_direction(order_params) == 'ASC' ? :desc : :asc)
|
.order(pdf_file_status: sort_direction(order_params) == 'ASC' ? :desc : :asc)
|
||||||
|
when 'reports.code'
|
||||||
|
sort_by = "reports.id #{sort_direction(order_params)}"
|
||||||
|
records.order(sort_by)
|
||||||
else
|
else
|
||||||
sort_by = "#{sort_column(order_params)} #{sort_direction(order_params)}"
|
sort_by = "#{sort_column(order_params)} #{sort_direction(order_params)}"
|
||||||
records.order(sort_by)
|
records.order(sort_by)
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
class MyModule < ApplicationRecord
|
class MyModule < ApplicationRecord
|
||||||
ID_PREFIX = 'TA'
|
ID_PREFIX = 'TA'
|
||||||
SEARCHABLE_ATTRIBUTES = ['my_modules.name', 'my_modules.description', PREFIXED_ID_SQL].freeze
|
|
||||||
|
|
||||||
include PrefixedIdModel
|
include PrefixedIdModel
|
||||||
|
SEARCHABLE_ATTRIBUTES = ['my_modules.name', 'my_modules.description', PREFIXED_ID_SQL].freeze
|
||||||
|
|
||||||
include ArchivableModel
|
include ArchivableModel
|
||||||
include SearchableModel
|
include SearchableModel
|
||||||
include SearchableByNameModel
|
include SearchableByNameModel
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
class Project < ApplicationRecord
|
class Project < ApplicationRecord
|
||||||
ID_PREFIX = 'PR'
|
ID_PREFIX = 'PR'
|
||||||
|
include PrefixedIdModel
|
||||||
SEARCHABLE_ATTRIBUTES = ['projects.name', PREFIXED_ID_SQL].freeze
|
SEARCHABLE_ATTRIBUTES = ['projects.name', PREFIXED_ID_SQL].freeze
|
||||||
|
|
||||||
include PrefixedIdModel
|
|
||||||
include ArchivableModel
|
include ArchivableModel
|
||||||
include SearchableModel
|
include SearchableModel
|
||||||
include SearchableByNameModel
|
include SearchableByNameModel
|
||||||
|
@ -12,9 +12,6 @@ class Project < ApplicationRecord
|
||||||
include PermissionCheckableModel
|
include PermissionCheckableModel
|
||||||
include Assignable
|
include Assignable
|
||||||
|
|
||||||
ID_PREFIX = 'PR'
|
|
||||||
include PrefixedIdModel
|
|
||||||
|
|
||||||
enum visibility: { hidden: 0, visible: 1 }
|
enum visibility: { hidden: 0, visible: 1 }
|
||||||
|
|
||||||
auto_strip_attributes :name, nullify: false
|
auto_strip_attributes :name, nullify: false
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
class Protocol < ApplicationRecord
|
class Protocol < ApplicationRecord
|
||||||
ID_PREFIX = 'PT'
|
ID_PREFIX = 'PT'
|
||||||
|
include PrefixedIdModel
|
||||||
SEARCHABLE_ATTRIBUTES = ['protocols.name', 'protocols.description',
|
SEARCHABLE_ATTRIBUTES = ['protocols.name', 'protocols.description',
|
||||||
'protocols.authors', 'protocol_keywords.name', PREFIXED_ID_SQL].freeze
|
'protocols.authors', 'protocol_keywords.name', PREFIXED_ID_SQL].freeze
|
||||||
|
|
||||||
include PrefixedIdModel
|
|
||||||
include SearchableModel
|
include SearchableModel
|
||||||
include RenamingUtil
|
include RenamingUtil
|
||||||
include SearchableByNameModel
|
include SearchableByNameModel
|
||||||
|
|
|
@ -2,18 +2,15 @@
|
||||||
|
|
||||||
class Report < ApplicationRecord
|
class Report < ApplicationRecord
|
||||||
ID_PREFIX = 'RP'
|
ID_PREFIX = 'RP'
|
||||||
|
include PrefixedIdModel
|
||||||
SEARCHABLE_ATTRIBUTES = ['reports.name', 'reports.description', PREFIXED_ID_SQL].freeze
|
SEARCHABLE_ATTRIBUTES = ['reports.name', 'reports.description', PREFIXED_ID_SQL].freeze
|
||||||
|
|
||||||
include PrefixedIdModel
|
|
||||||
include SettingsModel
|
include SettingsModel
|
||||||
include Assignable
|
include Assignable
|
||||||
include PermissionCheckableModel
|
include PermissionCheckableModel
|
||||||
include SearchableModel
|
include SearchableModel
|
||||||
include SearchableByNameModel
|
include SearchableByNameModel
|
||||||
|
|
||||||
ID_PREFIX = 'RP'
|
|
||||||
include PrefixedIdModel
|
|
||||||
|
|
||||||
enum pdf_file_status: { pdf_empty: 0, pdf_processing: 1, pdf_ready: 2, pdf_error: 3 }
|
enum pdf_file_status: { pdf_empty: 0, pdf_processing: 1, pdf_ready: 2, pdf_error: 3 }
|
||||||
enum docx_file_status: { docx_empty: 0, docx_processing: 1, docx_ready: 2, docx_error: 3 }
|
enum docx_file_status: { docx_empty: 0, docx_processing: 1, docx_ready: 2, docx_error: 3 }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue