mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Fix sorting in repositories when only assigned selected [SCI-1349]
This commit is contained in:
parent
da87a41c86
commit
13fdbf8850
1 changed files with 4 additions and 8 deletions
|
@ -244,18 +244,14 @@ class RepositoryDatatable < AjaxDatatablesRails::Base
|
|||
# as sq ORDER BY CASE WHEN sq.custom_field_id = #{column_id} THEN 1 ELSE 2 END #{dir}, sq.value #{dir}
|
||||
# LIMIT #{per_page} OFFSET #{offset}")
|
||||
|
||||
RepositoryRow.find_by_sql(
|
||||
"SELECT repository_rows.*, values.value AS value
|
||||
FROM repository_rows
|
||||
LEFT OUTER JOIN (SELECT repository_cells.*,
|
||||
records.joins(
|
||||
"LEFT OUTER JOIN (SELECT repository_cells.repository_row_id,
|
||||
repository_text_values.data AS value FROM repository_cells
|
||||
INNER JOIN repository_text_values
|
||||
ON repository_text_values.id = repository_cells.value_id
|
||||
WHERE repository_cells.repository_column_id = #{column_id}) AS values
|
||||
ON values.repository_row_id = repository_rows.id
|
||||
WHERE repository_rows.repository_id = #{@repository.id}
|
||||
ORDER BY value #{dir} LIMIT #{per_page} OFFSET #{offset}"
|
||||
)
|
||||
ON values.repository_row_id = repository_rows.id"
|
||||
).order("values.value #{dir}")
|
||||
else
|
||||
super(records)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue