FIX: only run Gift Exchange on Nov 20th

FIX: only run Gift Exchange on Nov 20th

diff --git a/jobs/scheduled/gift_exchange.rb b/jobs/scheduled/gift_exchange.rb
index f85edff..2c6d0c8 100644
--- a/jobs/scheduled/gift_exchange.rb
+++ b/jobs/scheduled/gift_exchange.rb
@@ -11,7 +11,7 @@ module Jobs
       return unless SiteSetting.dev_additions_enabled
 
       now = Time.zone.now
-      return if now.month != 11 && now.day != 20
+      return if now.month != 11 || now.day != 20
 
       group_name = "gift-exchange-#{now.year}"
       return unless group = Group.find_by(name: group_name)

GitHub sha: 24e71a1c

1 Like

I guess in this case return unless now.month == 11 && now.day == 20 would have been easier to read and less error-prone. IMHO sometimes it’s a good idea to use unless.

I guess? Either way it’s making my brain hurt 🤷‍♂

someone said my name :clown_face:

return if now.month != 11
return if now.day  != 20

That is the verbose way, pretty ugly but very very clear… clearer than unless imo.

1 Like

DEV: make exit condition more clear