Last active
December 13, 2016 16:09
-
-
Save bogdan/6a3b4751d4801db46175f5d69b9aace4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/models/visitor_offer.rb b/app/models/visitor_offer.rb | |
index 1d4f8f2807..e72771ad20 100644 | |
--- a/app/models/visitor_offer.rb | |
+++ b/app/models/visitor_offer.rb | |
@@ -307,20 +307,23 @@ class VisitorOffer < BaseModel | |
end | |
def click_reward_in_email! | |
- return click_reward if click_reward | |
- return if sample? | |
+ ensure_click_reward or | |
+ ( | |
+ return if sample? | |
- # E.g. when visitor_offer became self-referral after creating reward and no self-referral reward present, | |
- # or when visitor_offer became expired | |
- unless click_incentive | |
- raise Translatable::InterpolationError, | |
- "Coupon code was not found. Use {{coupon_code_exists}} to check if {{coupon_code}} is available" | |
- end | |
+ # E.g. when visitor_offer became self-referral after creating reward and no self-referral reward present, | |
+ # or when visitor_offer became expired | |
+ unless click_incentive | |
+ raise Translatable::InterpolationError, | |
+ "Coupon code was not found. Use {{campaign_rules.coupon_in_share_email_available}} to check if {{coupon_code}} is available" | |
+ end | |
- raise "Click reward is not found for: #{inspect}" | |
+ raise "Click reward is not found for: #{inspect}" | |
+ ) | |
end | |
def coupon | |
+ raise 'called?' | |
# Don't use it in reports: it can return nil when coupon exists in reality | |
click_reward&.coupon | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment