Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed tests and reduced emails specs noise #1902

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/services/stash_engine/abandoned_dataset_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def send_peer_review_reminders
create_activity(reminder_flag, resource)
end
rescue StandardError => e
p " Exception! #{e.message}"
log " Exception! #{e.message}"
end
true
end
Expand Down Expand Up @@ -126,7 +126,7 @@ def send_final_withdrawn_notification
StashEngine::ResourceMailer.send_final_withdrawn_notification(resource).deliver_now
create_activity(reminder_flag, resource)
rescue StandardError => e
p " Exception! #{e.message}"
log " Exception! #{e.message}"
end
true
end
Expand All @@ -145,8 +145,9 @@ def create_activity(flag, resource, status: nil, note: nil)

def log(message)
return unless logging
return if Rails.env.test?

p message
puts message
end

def log_data_for_status(status, resource)
Expand Down
16 changes: 11 additions & 5 deletions lib/tasks/dataset_deletion_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,38 @@ namespace :dataset_deletion do

desc 'Send monthly email reminder to the submitter when a dataset has been `in_progress` for more then 1 month'
task in_progress_reminders: :environment do
p 'Mailing users whose datasets have been in_progress for more then 1 months'
log 'Mailing users whose datasets have been in_progress for more then 1 months'
StashEngine::AbandonedDatasetService.new(logging: true).send_in_progress_reminders
end

desc 'Send monthly email reminder to the submitter when a dataset has been in `action_required` for more then 1 month'
task in_action_required_reminders: :environment do
p 'Mailing users whose datasets have been action_required for more then 1 month'
log 'Mailing users whose datasets have been action_required for more then 1 month'
StashEngine::AbandonedDatasetService.new(logging: true).send_action_required_reminders
end

desc 'Send monthly email reminder to the submitter when a dataset has been in `peer_review` for more then 6 months'
task in_peer_review_reminders: :environment do
p 'Mailing users whose datasets have been peer_review for more then 6 months'
log 'Mailing users whose datasets have been peer_review for more then 6 months'
StashEngine::AbandonedDatasetService.new(logging: true).send_peer_review_reminders
end

desc 'Withdraw datasets and send email reminder to the submitter'
task auto_withdraw: :environment do
p 'Mailing users whose datasets are being withdrawn'
log 'Mailing users whose datasets are being withdrawn'
StashEngine::AbandonedDatasetService.new(logging: true).auto_withdraw
end

desc 'Send final withdraw email reminder to the submitter'
task final_withdrawn_notification: :environment do
p 'Mailing users whose datasets are being withdrawn'
log 'Mailing users whose datasets are being withdrawn'
StashEngine::AbandonedDatasetService.new(logging: true).send_final_withdrawn_notification
end
end

def log(message)
return if Rails.env.test?

p message
end
# :nocov:
Loading