mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 19:24:48 +08:00
Fix notifications being triggered for archived models [SCI-9967]
This commit is contained in:
parent
465c8d1f80
commit
05c376a14b
2 changed files with 14 additions and 5 deletions
|
@ -12,9 +12,12 @@ class RepositoryItemDateReminderJob < ApplicationJob
|
|||
|
||||
def process_repository_values(model, comparison_value)
|
||||
model
|
||||
.joins(repository_cell: { repository_column: :repository })
|
||||
.where(notification_sent: false, repositories: { type: 'Repository' })
|
||||
.where('repository_date_time_values.updated_at >= ?', 2.days.ago)
|
||||
.joins(repository_cell: [:repository_row, { repository_column: :repository }])
|
||||
.where(
|
||||
notification_sent: false,
|
||||
repositories: { type: 'Repository', archived: false },
|
||||
repository_rows: { archived: false }
|
||||
).where('repository_date_time_values.updated_at >= ?', 2.days.ago)
|
||||
.where( # date(time) values that are within the reminder range
|
||||
"data <= " \
|
||||
"(?::timestamp + CAST(((repository_columns.metadata->>'reminder_unit')::int * " \
|
||||
|
|
|
@ -141,8 +141,14 @@ class MyModule < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.approaching_due_dates
|
||||
where(due_date_notification_sent: false)
|
||||
.where('due_date > ? AND due_date <= ?', DateTime.current, DateTime.current + 1.day)
|
||||
joins(experiment: :project)
|
||||
.active
|
||||
.where(
|
||||
due_date_notification_sent: false,
|
||||
projects: { archived: false },
|
||||
experiments: { archived: false }
|
||||
)
|
||||
.where('my_modules.due_date > ? AND my_modules.due_date <= ?', DateTime.current, DateTime.current + 1.day)
|
||||
end
|
||||
|
||||
def parent
|
||||
|
|
Loading…
Reference in a new issue