Created
June 5, 2015 14:20
-
-
Save bogdan/34c7bad08b842f38d975 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/campaign.rb b/app/models/campaign.rb | |
index f1b12a5..7d54830 100644 | |
--- a/app/models/campaign.rb | |
+++ b/app/models/campaign.rb | |
@@ -687,10 +687,13 @@ class Campaign < BaseModel | |
end | |
def expires_at_for_share | |
+ # If new share needs to be created in expired campaign | |
+ # we prepare only set it relatively to the campaign deactivation | |
+ start_time = active? ? Time.now : expires_at | |
[ | |
# Rounded up to an hour, to reduce count of short_urls | |
# and make share detection easier | |
- offer_duration.present? ? (DateTime.now + offer_duration.hours).end_of_hour : nil, | |
+ offer_duration.present? ? (start_time + offer_duration.hours).end_of_hour : nil, | |
friend_deadline, | |
].compact.min.try(:in_time_zone) | |
end | |
@@ -858,18 +861,18 @@ protected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment