hackatime/app/jobs/weekly_summary_email_job.rb
Mahad Kalam d5d987a8f4
Email layout v2 (#1015)
* Better emails!

* Fix tests?

* bit o' cleanup

* add rant

* pt2

* pt3

* Update tests

* oop

* man what on earth

* ffs!!!!!

* Revert "ffs!!!!!"

This reverts commit b58bfed0f4c6288e95d0a111aeb3d7d7900ac9e7.

* Revert "man what on earth"

This reverts commit 8752cc2200eb3b852ea545d10ccbd555ab09d2b4.

* Revert "Fix tests?"

This reverts commit 810ebde73376ff7da0595e6b927f1b464d62b4a4.

* Ignore external Google Fonts link in premailer
2026-03-01 07:18:24 +00:00

38 lines
1.3 KiB
Ruby

class WeeklySummaryEmailJob < ApplicationJob
queue_as :literally_whenever
def perform(reference_time = Time.current)
# Weekly summary delivery is intentionally disabled for now.
# Context: https://hackclub.slack.com/archives/D083UR1DR7V/p1772321709715969
# Keep this no-op until we explicitly decide to turn the campaign back on.
reference_time
# now_utc = reference_time.utc
# return unless send_window?(now_utc)
# User.where(weekly_summary_email_enabled: true).find_each do |user|
# recipient_email = user.email_addresses.order(:id).pick(:email)
# next if recipient_email.blank?
# user_timezone = ActiveSupport::TimeZone[user.timezone] || ActiveSupport::TimeZone["UTC"]
# user_now = now_utc.in_time_zone(user_timezone)
# ends_at_local = user_now.beginning_of_week(:monday)
# starts_at_local = ends_at_local - 1.week
# WeeklySummaryMailer.weekly_summary(
# user,
# recipient_email: recipient_email,
# starts_at: starts_at_local.utc,
# ends_at: ends_at_local.utc
# ).deliver_now
# rescue StandardError => e
# Rails.logger.error("Weekly summary email failed for user #{user.id}: #{e.class} #{e.message}")
# end
end
private
def send_window?(time)
time.friday? && time.hour == 17 && time.min == 30
end
end