From eeb32fcc318a71dd0dd978b3de1d41a3ca679d54 Mon Sep 17 00:00:00 2001 From: Mike Sanders Date: Fri, 16 Jan 2026 11:38:26 +0100 Subject: [PATCH 1/2] add stale events in curation mail --- app/mailers/curation_mailer.rb | 3 +- .../events_require_approval.html.erb | 37 ++++++++++++++++++- .../events_require_approval.text.erb | 23 +++++++++++- 3 files changed, 58 insertions(+), 5 deletions(-) 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..59f5067e9 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 taxila 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..2e226d92e 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 taxila 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 %> From bd29987c0aeb4ee144e189be39273091a4b8f688 Mon Sep 17 00:00:00 2001 From: Mike Sanders Date: Wed, 21 Jan 2026 15:42:23 +0100 Subject: [PATCH 2/2] use localized site name in stale events curation mail --- app/views/curation_mailer/events_require_approval.html.erb | 2 +- app/views/curation_mailer/events_require_approval.text.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/curation_mailer/events_require_approval.html.erb b/app/views/curation_mailer/events_require_approval.html.erb index 59f5067e9..1a5a286de 100644 --- a/app/views/curation_mailer/events_require_approval.html.erb +++ b/app/views/curation_mailer/events_require_approval.html.erb @@ -36,7 +36,7 @@ <% if @stale_events.count.positive? %>

- These events have not been updated/found by the taxila recently.
+ 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.

diff --git a/app/views/curation_mailer/events_require_approval.text.erb b/app/views/curation_mailer/events_require_approval.text.erb index 2e226d92e..df0ce93a3 100644 --- a/app/views/curation_mailer/events_require_approval.text.erb +++ b/app/views/curation_mailer/events_require_approval.text.erb @@ -21,7 +21,7 @@ New events: Stale events: <% if @stale_events.count.positive? %> - These events have not been updated/found by the taxila recently.
+ 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.