diff --git a/app/mailers/curation_mailer.rb b/app/mailers/curation_mailer.rb index a8679dbdc..d5f4af9be 100644 --- a/app/mailers/curation_mailer.rb +++ b/app/mailers/curation_mailer.rb @@ -29,7 +29,8 @@ def events_require_approval(provider, cut_off_time) return unless @provider.content_curation_email.present? # @events = @provider.events.where { |e| e.lmm_processed > cut_off_time } - @events = @provider.events.filter { |e| e.created_at > cut_off_time } + @new_events = @provider.events.filter { |e| e.created_at > cut_off_time } + @stale_events = @provider.events.filter { |e| e.stale? } subject = t('mailer.events_require_approval.subject') mail(subject:, to: @provider.content_curation_email) do |format| format.html diff --git a/app/views/curation_mailer/events_require_approval.html.erb b/app/views/curation_mailer/events_require_approval.html.erb index 11287c730..1a5a286de 100644 --- a/app/views/curation_mailer/events_require_approval.html.erb +++ b/app/views/curation_mailer/events_require_approval.html.erb @@ -1,14 +1,19 @@

You are receiving this automated email because you are a curator of <%= @provider.title %> on <%= TeSS::Config.site['title_short'] %>.

-<% if @events.count.positive? %> + +

+ New events: +

+ +<% if @new_events.count.positive? %>

If any of these events are incorrect or should not be shown, please follow the link to change them.
If an event should not be shown, disable it on the edit page instead of deleting it to prevent rescraping.
If an event needs changes, lock the changed fields to prevent your changes from being overwritten by the scraper.

- <% @events.each do |event| %> + <% @new_events.each do |event| %>

<%= link_to event.title, event %>
description: <%= event.description %>
@@ -24,3 +29,31 @@ There were no new events this week.

<% end %> + +

+ Stale events: +

+ +<% if @stale_events.count.positive? %> +

+ These events have not been updated/found by the <%= TeSS::Config.site['title_short'] %> recently.
+ If all events for <%= @provider.title %> are stale, the source might have changed, breaking the <%= TeSS::Config.site['title_short'] %> scraper.
+ If another duplicate of this event was made, maybe the address to the event page was changed.
+

+ + <% @stale_events.each do |event| %> +

+ <%= link_to event.title, event %>
+ description: <%= event.description %>
+ start: <%= event.start %>
+ end: <%= event.end %>
+ venue: <%= event.venue %>
+ show: <%= event.visible %>
+

+ + <% end %> +<% else %> +

+ There were no stale events this week. +

+<% end %> diff --git a/app/views/curation_mailer/events_require_approval.text.erb b/app/views/curation_mailer/events_require_approval.text.erb index 363e66797..df0ce93a3 100644 --- a/app/views/curation_mailer/events_require_approval.text.erb +++ b/app/views/curation_mailer/events_require_approval.text.erb @@ -1,10 +1,12 @@ You are receiving this automated email because you are a curator of <%= @provider.title %> on <%= TeSS::Config.site['title_short'] %>. -<% if @events.count.positive? %> + +New events: +<% if @new_events.count.positive? %> If any of these events are incorrect or should not be shown, please follow the link to change them. If an event should not be shown, disable it on the edit page instead of deleting it to prevent rescraping. If an event needs changes, lock the changed fields to prevent your changes from being overwritten by the scraper. - <% @events.each do |event| %> + <% @new_events.each do |event| %> <%= event.title %> (<%= url_for(event) %>) description: <%= event.description %> start: <%= event.start %> @@ -17,4 +19,21 @@ You are receiving this automated email because you are a curator of <%= @provide There were no new events this week. <% end %> +Stale events: +<% if @stale_events.count.positive? %> + These events have not been updated/found by the <%= TeSS::Config.site['title_short'] %> recently.
+ If all events for <%= @provider.title %> are stale, the source might have changed, breaking the <%= TeSS::Config.site['title_short'] %> scraper.
+ If another duplicate of this event was made, maybe the address to the event page was changed.
+ <% @stale_events.each do |event| %> + <%= event.title %> (<%= url_for(event) %>) + description: <%= event.description %> + start: <%= event.start %> + end: <%= event.end %> + venue: <%= event.venue %> + show: <%= event.visible %> + + <% end %> +<% else %> + There were no stale events this week. +<% end %>