Created
December 28, 2016 15:59
-
-
Save littlemove/da2a2bcdd639ec3d466bd3658c71de95 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# current | |
add_ad_hoc_metadata_key "Available Offline" do | |
return false if [territory_iso, business_model].any?(&:blank?) | |
target = title.series.try(:mov_series) || title.mov_title | |
availabilities = metadata(target, "WHATS'On:Offline Availability") | |
availabilities.any? do |entry| | |
entry = OfflineAvail.new(*entry.split('^')) | |
entry.business_model_matches?(business_model) && | |
entry.territory_matches?(territory_iso) && | |
entry.starts_before?(starts_at) && | |
entry.ends_after?(ends_at) | |
end | |
end | |
# new | |
add_ad_hoc_metadata_key "Available Offline" do | |
if [territory_iso, business_model].any?(&:blank?) | |
false | |
else | |
target = title.series.try(:mov_series) || title.mov_title | |
availabilities = metadata(target, "WHATS'On:Offline Availability") | |
availabilities.any? do |entry| | |
entry = OfflineAvail.new(*entry.split('^')) | |
entry.business_model_matches?(business_model) && | |
entry.territory_matches?(territory_iso) && | |
entry.starts_before?(starts_at) && | |
entry.ends_after?(ends_at) | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment