mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 03:36:44 +08:00
Code fixes [SCI-1873]
This commit is contained in:
parent
512ee07bde
commit
070711917e
1 changed files with 32 additions and 35 deletions
|
@ -183,7 +183,8 @@ class RepositoryDatatable < CustomDatatable
|
|||
# number of samples/all samples it's dependant upon sort_record query
|
||||
def fetch_records
|
||||
records = get_raw_records
|
||||
records = filter_records(records) if dt_params[:search].present?
|
||||
records = filter_records(records) if dt_params[:search].present? &&
|
||||
dt_params[:search][:value].present?
|
||||
records = sort_records(records) if order_params.present?
|
||||
records = paginate_records(records) unless dt_params[:length].present? &&
|
||||
dt_params[:length] == '-1'
|
||||
|
@ -232,7 +233,6 @@ class RepositoryDatatable < CustomDatatable
|
|||
|
||||
# Override default sort method if needed
|
||||
def sort_records(records)
|
||||
if order_params.present?
|
||||
if sort_column(order_params) == ASSIGNED_SORT_COL
|
||||
# If "assigned" column is sorted when viewing assigned items
|
||||
return records if @my_module && dt_params[:assigned] == 'assigned'
|
||||
|
@ -268,9 +268,6 @@ class RepositoryDatatable < CustomDatatable
|
|||
else
|
||||
super(records)
|
||||
end
|
||||
else
|
||||
super(records)
|
||||
end
|
||||
end
|
||||
|
||||
def sort_null_direction(item)
|
||||
|
@ -323,7 +320,7 @@ class RepositoryDatatable < CustomDatatable
|
|||
ids = unassigned + assigned
|
||||
end
|
||||
|
||||
order_by_index = ActiveRecord::Base.__send__(
|
||||
order_by_index = ActiveRecord::Base.send(
|
||||
:sanitize_sql_array,
|
||||
["position((',' || repository_rows.id || ',') in ?)",
|
||||
ids.join(',') + ',']
|
||||
|
|
Loading…
Reference in a new issue