mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
Improve code style [SCI-6151]
This commit is contained in:
parent
2051ea5360
commit
b1b7dbb8ef
3 changed files with 3 additions and 5 deletions
|
@ -41,7 +41,7 @@ class Checklist < ApplicationRecord
|
||||||
|
|
||||||
new_query = Checklist.distinct
|
new_query = Checklist.distinct
|
||||||
.where(checklists: { step_id: step_ids })
|
.where(checklists: { step_id: step_ids })
|
||||||
.joins('LEFT JOIN checklist_items ON checklists.id = checklist_items.checklist_id')
|
.left_outer_joins(:checklist_items)
|
||||||
.where_attributes_like(['checklists.name', 'checklist_items.text'], query, options)
|
.where_attributes_like(['checklists.name', 'checklist_items.text'], query, options)
|
||||||
|
|
||||||
# Show all results if needed
|
# Show all results if needed
|
||||||
|
|
|
@ -46,9 +46,7 @@ class Table < ApplicationRecord
|
||||||
.pluck('result_tables.id')
|
.pluck('result_tables.id')
|
||||||
|
|
||||||
table_query = Table.distinct
|
table_query = Table.distinct
|
||||||
.joins('LEFT OUTER JOIN step_tables ON step_tables.table_id = tables.id')
|
.left_outer_joins(:step_table, :result_table, :result)
|
||||||
.joins('LEFT OUTER JOIN result_tables ON result_tables.table_id = tables.id')
|
|
||||||
.joins('LEFT OUTER JOIN results ON result_tables.result_id = results.id')
|
|
||||||
.where('step_tables.id IN (?) OR result_tables.id IN (?)', step_ids, result_ids)
|
.where('step_tables.id IN (?) OR result_tables.id IN (?)', step_ids, result_ids)
|
||||||
|
|
||||||
if options[:whole_word].to_s == 'true' ||
|
if options[:whole_word].to_s == 'true' ||
|
||||||
|
|
|
@ -373,7 +373,7 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
if team_to_ignore.present?
|
if team_to_ignore.present?
|
||||||
ignored_ids = UserTeam.select(:user_id).where(team_id: team_to_ignore.id)
|
ignored_ids = UserTeam.select(:user_id).where(team_id: team_to_ignore.id)
|
||||||
result = result.where.not('users.id IN (?)', ignored_ids)
|
result = result.where.not(users: { id: ignored_ids })
|
||||||
end
|
end
|
||||||
|
|
||||||
result.where_attributes_like(%i(full_name email), query).distinct
|
result.where_attributes_like(%i(full_name email), query).distinct
|
||||||
|
|
Loading…
Reference in a new issue