Skip to content

Commit

Permalink
Update inat import complete email (#4136)
Browse files Browse the repository at this point in the history
* Update inat import complete email

* Update text in spec

* remove focus
  • Loading branch information
zwolf authored Mar 8, 2023
1 parent dc4bef0 commit 8e0b9a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/mailers/inat_import_completed_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def inat_import_complete(ss_import)
lab_url_prefix = "#{Panoptes.frontend_url}/lab/#{project_id}"
@subject_set_lab_url = "#{lab_url_prefix}/subject-sets/#{ss_import.subject_set_id}"
@subject_set_name = ss_import.subject_set.display_name
@failed_ids = ss_import.failed_uuids

@no_errors = ss_import.failed_count.zero?
import_status = @no_errors ? 'was successful!' : 'completed with errors'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ Your iNaturalist subject import has finished processing.
<% if @no_errors %>
The iNaturalist observations have been imported successfully.
<% else %>
There were some errors when importing your iNaturalist observations.
Some observations could not be imported.
Observations with the following iNaturalist IDs are not included in your subject set:

<%= @failed_ids.join(', ') %>
<% end %>

<%= @imported_count %> subjects were imported into subject set '<%= @subject_set_name %>'.

To view them, visit: <%= @subject_set_lab_url %>

If you have questions or if there were any issues with your import, please email [email protected].

Cheers,
The Zooniverse Team

Expand Down
10 changes: 5 additions & 5 deletions spec/mailers/inat_import_completed_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
end

context 'with a failed subject set import' do
let(:ss_import) { create(:subject_set_import, subject_set: subject_set, failed_count: 1) }
let(:ss_import) { create(:subject_set_import, subject_set: subject_set, failed_count: 3, failed_uuids: [111, 222, 333]) }

it 'includes the failed subject suffix' do
expect(mail.subject).to include('Your iNaturalist subject import completed with errors')
it 'reports the failures statement' do
expect(mail.body.encoded).to include('Some observations could not be imported.')
end

it 'reports the failures statement' do
expect(mail.body.encoded).to include('There were some errors when importing your iNaturalist observations.')
it 'includes the failed ids' do
expect(mail.body.encoded).to include('111, 222, 333')
end
end
end
Expand Down

0 comments on commit 8e0b9a4

Please sign in to comment.