mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 11:46:25 +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)
|
def process_repository_values(model, comparison_value)
|
||||||
model
|
model
|
||||||
.joins(repository_cell: { repository_column: :repository })
|
.joins(repository_cell: [:repository_row, { repository_column: :repository }])
|
||||||
.where(notification_sent: false, repositories: { type: 'Repository' })
|
.where(
|
||||||
.where('repository_date_time_values.updated_at >= ?', 2.days.ago)
|
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
|
.where( # date(time) values that are within the reminder range
|
||||||
"data <= " \
|
"data <= " \
|
||||||
"(?::timestamp + CAST(((repository_columns.metadata->>'reminder_unit')::int * " \
|
"(?::timestamp + CAST(((repository_columns.metadata->>'reminder_unit')::int * " \
|
||||||
|
|
|
@ -141,8 +141,14 @@ class MyModule < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.approaching_due_dates
|
def self.approaching_due_dates
|
||||||
where(due_date_notification_sent: false)
|
joins(experiment: :project)
|
||||||
.where('due_date > ? AND due_date <= ?', DateTime.current, DateTime.current + 1.day)
|
.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
|
end
|
||||||
|
|
||||||
def parent
|
def parent
|
||||||
|
|
Loading…
Reference in a new issue