mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 05:34:53 +08:00
Optimize date time reminders query for inventories [SCI-11156] (#8018)
This commit is contained in:
parent
458e8b9a86
commit
83150f59c0
1 changed files with 3 additions and 3 deletions
|
@ -77,9 +77,9 @@ class RepositoryCell < ApplicationRecord
|
|||
'"repository_date_time_values"."id" = "repository_cells"."value_id" AND ' \
|
||||
'"repository_cells"."value_type" = \'RepositoryDateTimeValueBase\' ' \
|
||||
'AND repository_reminder_columns.metadata ->> \'reminder_value\' <> \'\' AND ' \
|
||||
'(repository_date_time_values.data - NOW()) <= ' \
|
||||
'(repository_reminder_columns.metadata ->> \'reminder_value\')::int * ' \
|
||||
'(repository_reminder_columns.metadata ->> \'reminder_unit\')::int * interval \'1 sec\''
|
||||
'repository_date_time_values.data <= ' \
|
||||
'(NOW() AT TIME ZONE \'UTC\') + (repository_reminder_columns.metadata ->> \'reminder_value\')::int * ' \
|
||||
'(repository_reminder_columns.metadata ->> \'reminder_unit\')::int * \'1 SECOND\'::interval'
|
||||
).joins(
|
||||
'LEFT OUTER JOIN "hidden_repository_cell_reminders" ON ' \
|
||||
'"repository_cells"."id" = "hidden_repository_cell_reminders"."repository_cell_id" AND ' \
|
||||
|
|
Loading…
Reference in a new issue