Skip to content

Commit

Permalink
fix: update default value
Browse files Browse the repository at this point in the history
  • Loading branch information
ruilopesm committed Nov 12, 2023
1 parent 8cfe57a commit 840198f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/safira/job_scheduler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,45 @@ defmodule Safira.JobScheduler do
end

# FIXME: These are only examples. Should be updated to the real jobs, with the correct parameters
# and should be set to active (refer to create_job/4 function)
# and should be set to active.
defp load_jobs do
[
create_job(:daily_badge, ~e[0 * * * *], {Jobs.DailyBadge, :run, [123, "2023-12-01"]}),
create_job(:all_gold_badge, ~e[5 * * * *], {Jobs.AllGoldBadge, :run, [123]}),
create_job(:daily_badge, ~e[0 * * * *], {Jobs.DailyBadge, :run, [123, "2023-12-01"]}, :inactive),
create_job(:all_gold_badge, ~e[5 * * * *], {Jobs.AllGoldBadge, :run, [123]}, :inactive),
create_job(
:full_participation_badge,
~e[10 * * * *],
{Jobs.FullParticipationBadge, :run, [123]}
{Jobs.FullParticipationBadge, :run, [123]},
:inactive
),
create_job(
:participate_in_two_days,
~e[15 * * * *],
{Jobs.ParticipationBadge, :run, [123, 2]}
{Jobs.ParticipationBadge, :run, [123, 2]},
:inactive
),
create_job(
:redeem_fifty_badges,
~e[25 * * * *],
{Jobs.CheckpointBadge, :run, [123, 50, 0]}
{Jobs.CheckpointBadge, :run, [123, 50, 0]},
:inactive
),
create_job(
:attend_three_workshops,
~e[30 * * * *],
{Jobs.CheckpointBadge, :run, [123, 3, 7]}
{Jobs.CheckpointBadge, :run, [123, 3, 7]},
:inactive
),
create_job(
:visit_twenty_booths,
~e[20 * * * *],
{Jobs.CheckpointBadgeWithRedeemable, :run, [123, 20, 4, 30, 456]}
{Jobs.CheckpointBadgeWithRedeemable, :run, [123, 20, 4, 30, 456]},
:inactive
)
]
end

defp create_job(name, schedule, task, state \\ :inactive) do
defp create_job(name, schedule, task, state \\ :active) do

Check warning on line 52 in lib/safira/job_scheduler.ex

View workflow job for this annotation

GitHub Actions / OTP 25.x / Elixir 1.14.x

default values for the optional arguments in create_job/4 are never used
Safira.JobScheduler.new_job()
|> Quantum.Job.set_name(name)
|> Quantum.Job.set_schedule(schedule)
Expand Down

0 comments on commit 840198f

Please sign in to comment.