Skip to content
Open
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
3 changes: 2 additions & 1 deletion app/mailers/curation_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 35 additions & 2 deletions app/views/curation_mailer/events_require_approval.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<p>
You are receiving this automated email because you are a curator of <%= @provider.title %> on <%= TeSS::Config.site['title_short'] %>.
</p>
<% if @events.count.positive? %>

<p>
<strong>New events:</strong>
</p>

<% if @new_events.count.positive? %>
<p>
If any of these events are incorrect or should not be shown, please follow the link to change them.<br/>
If an event should not be shown, disable it on the edit page instead of deleting it to prevent rescraping.<br/>
If an event needs changes, lock the changed fields to prevent your changes from being overwritten by the scraper.<br/>
</p>

<% @events.each do |event| %>
<% @new_events.each do |event| %>
<p>
<%= link_to event.title, event %><br/>
<strong>description:</strong> <%= event.description %><br/>
Expand All @@ -24,3 +29,31 @@
There were no new events this week.
</p>
<% end %>

<p>
<strong>Stale events:</strong>
</p>

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

<% @stale_events.each do |event| %>
<p>
<%= link_to event.title, event %><br/>
<strong>description:</strong> <%= event.description %><br/>
<strong>start:</strong> <%= event.start %><br/>
<strong>end:</strong> <%= event.end %><br/>
<strong>venue:</strong> <%= event.venue %><br/>
<strong>show:</strong> <%= event.visible %><br/>
</p>

<% end %>
<% else %>
<p>
There were no stale events this week.
</p>
<% end %>
23 changes: 21 additions & 2 deletions app/views/curation_mailer/events_require_approval.text.erb
Original file line number Diff line number Diff line change
@@ -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 %>
Expand All @@ -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.<br/>
If all events for <%= @provider.title %> are stale, the source might have changed, breaking the <%= TeSS::Config.site['title_short'] %> scraper.<br/>
If another duplicate of this event was made, maybe the address to the event page was changed.<br/>

<% @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 %>