From 5639bbb59ba996f7da74891e490bab3360534af7 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Thu, 8 Feb 2024 12:31:02 +0000 Subject: [PATCH] fix: cron jobs (#400) --- lib/safira/job_scheduler.ex | 16 ++++++++-------- lib/safira/jobs/all_gold_badge.ex | 2 +- lib/safira/jobs/checkpoint_badge.ex | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/safira/job_scheduler.ex b/lib/safira/job_scheduler.ex index 1fa494c9..f9c3e53c 100644 --- a/lib/safira/job_scheduler.ex +++ b/lib/safira/job_scheduler.ex @@ -79,42 +79,42 @@ defmodule Safira.JobScheduler do ), create_job( :visit_five_booths, - ~e[20 * * * *], + ~e[13 * * * *], {Jobs.CheckpointBadge, :run, [235, 5, 4, 10]} ), create_job( :visit_ten_booths, - ~e[21 * * * *], + ~e[14 * * * *], {Jobs.CheckpointBadge, :run, [236, 10, 4, 30]} ), create_job( :visit_fifteen_booths, - ~e[22 * * * *], + ~e[15 * * * *], {Jobs.CheckpointBadge, :run, [237, 15, 4, 60]} ), create_job( :visit_twenty_booths, - ~e[23 * * * *], + ~e[16 * * * *], {Jobs.CheckpointBadge, :run, [238, 20, 4, 100]} ), create_job( :visit_twenty_five_booths, - ~e[24 * * * *], + ~e[17 * * * *], {Jobs.CheckpointBadge, :run, [239, 25, 4, 120]} ), create_job( :visit_all_booths, - ~e[25 * * * *], + ~e[18 * * * *], {Jobs.CheckpointBadge, :run, [240, 28, 4, 150]} ), create_job( :upload_cv, - ~e[26 * * * *], + ~e[19 * * * *], {Jobs.CVBadge, :run, [294]} ), create_job( :spotlight, - ~e[27 * * * *], + ~e[20 * * * *], {Jobs.SpotlightBadge, :run, [242]} ) ] diff --git a/lib/safira/jobs/all_gold_badge.ex b/lib/safira/jobs/all_gold_badge.ex index 7dc1bd6a..62bccef8 100644 --- a/lib/safira/jobs/all_gold_badge.ex +++ b/lib/safira/jobs/all_gold_badge.ex @@ -15,7 +15,7 @@ defmodule Safira.Jobs.AllGoldBadge do @spec run(integer()) :: :ok def run(badge_id) do list_eligible_attendees() - |> Enum.each(&create_redeem(&1.id, badge_id)) + |> Enum.each(&create_redeem(&1, badge_id)) end defp list_eligible_attendees do diff --git a/lib/safira/jobs/checkpoint_badge.ex b/lib/safira/jobs/checkpoint_badge.ex index 725dda13..0dc4747d 100644 --- a/lib/safira/jobs/checkpoint_badge.ex +++ b/lib/safira/jobs/checkpoint_badge.ex @@ -69,5 +69,6 @@ defmodule Safira.Jobs.CheckpointBadge do } ) ) + |> Repo.transaction() end end