Add the possibility to disable weekly email notifications (instructeur) && rename the column email_notifications_enabled to daily_email_notification_enabled

This commit is contained in:
kara Diaby 2020-02-11 15:51:15 +01:00 committed by GitHub Action
parent 35b608fb7d
commit 0b8a59d5e9
6 changed files with 33 additions and 8 deletions

View file

@ -75,11 +75,12 @@ class Instructeur < ApplicationRecord
start_date = Time.zone.now.beginning_of_week
active_procedure_overviews = procedures
.where(assign_tos: { weekly_email_notifications_enabled: true })
.publiees
.map { |procedure| procedure.procedure_overview(start_date, groupe_instructeurs) }
.filter(&:had_some_activities?)
if active_procedure_overviews.count == 0
if active_procedure_overviews.empty?
nil
else
{