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({
|
columns.push({
|
||||||
field: 'comments',
|
field: 'comments',
|
||||||
headerName: this.i18n.t('experiments.table.column.comments_html'),
|
headerName: this.i18n.t('experiments.table.column.comments_html'),
|
||||||
sortable: false,
|
sortable: true,
|
||||||
cellRenderer: CommentsRenderer,
|
cellRenderer: CommentsRenderer,
|
||||||
notSelectable: true
|
notSelectable: true
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ module Lists
|
||||||
designated: 'designated',
|
designated: 'designated',
|
||||||
results: 'results',
|
results: 'results',
|
||||||
tags: 'tags',
|
tags: 'tags',
|
||||||
signatures: 'signatures'
|
signatures: 'signatures',
|
||||||
|
comments: 'comments'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -83,6 +84,14 @@ module Lists
|
||||||
@records = @records.order(:my_module_status_id)
|
@records = @records.order(:my_module_status_id)
|
||||||
when 'status_DESC'
|
when 'status_DESC'
|
||||||
@records = @records.order(my_module_status_id: :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'
|
when 'designated_ASC'
|
||||||
@records = @records.left_joins(:user_my_modules)
|
@records = @records.left_joins(:user_my_modules)
|
||||||
.group('my_modules.id')
|
.group('my_modules.id')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue