mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-10 06:06:24 +08:00
Add sorting to task comments
This commit is contained in:
parent
74ce54f832
commit
b3e4b14800
2 changed files with 11 additions and 2 deletions
|
|
@ -174,7 +174,7 @@ export default {
|
|||
columns.push({
|
||||
field: 'comments',
|
||||
headerName: this.i18n.t('experiments.table.column.comments_html'),
|
||||
sortable: false,
|
||||
sortable: true,
|
||||
cellRenderer: CommentsRenderer,
|
||||
notSelectable: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ module Lists
|
|||
designated: 'designated',
|
||||
results: 'results',
|
||||
tags: 'tags',
|
||||
signatures: 'signatures'
|
||||
signatures: 'signatures',
|
||||
comments: 'comments'
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -83,6 +84,14 @@ module Lists
|
|||
@records = @records.order(:my_module_status_id)
|
||||
when 'status_DESC'
|
||||
@records = @records.order(my_module_status_id: :desc)
|
||||
when 'comments_ASC'
|
||||
@records = @records.left_joins(:task_comments)
|
||||
.group('my_modules.id')
|
||||
.order(Arel.sql('COUNT(DISTINCT comments.id) ASC'))
|
||||
when 'comments_DESC'
|
||||
@records = @records.left_joins(:task_comments)
|
||||
.group('my_modules.id')
|
||||
.order(Arel.sql('COUNT(DISTINCT comments.id) DESC'))
|
||||
when 'designated_ASC'
|
||||
@records = @records.left_joins(:user_my_modules)
|
||||
.group('my_modules.id')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue