diff --git a/app/models/apple/episode.rb b/app/models/apple/episode.rb index 8738584cc..d55ca38ea 100644 --- a/app/models/apple/episode.rb +++ b/app/models/apple/episode.rb @@ -385,8 +385,8 @@ def drafting? apple_json&.dig("attributes", "publishingState") == "DRAFTING" end - def apple_upload_complete? - feeder_episode.apple_podcast_container.skip_delivery? + def container_upload_complete? + feeder_episode.apple_podcast_container.container_upload_satisfied? end def audio_asset_vendor_id @@ -437,7 +437,7 @@ def reset_for_upload! end def synced_with_apple? - audio_asset_state_success? && apple_upload_complete? && !drafting? + audio_asset_state_success? && container_upload_complete? && !drafting? end def waiting_for_asset_state? diff --git a/app/models/apple/podcast_container.rb b/app/models/apple/podcast_container.rb index c6b3bb2cc..f1ecf6e50 100644 --- a/app/models/apple/podcast_container.rb +++ b/app/models/apple/podcast_container.rb @@ -268,6 +268,10 @@ def delivery_settled? end def skip_delivery? + container_upload_satisfied? + end + + def container_upload_satisfied? # Sets us up for a retry if something prevented the audio from being # marked as uploaded and then processed and validated. Assuming that we # get to that point and the audio is still missing, we should be able to diff --git a/app/models/apple/publisher.rb b/app/models/apple/publisher.rb index 1196ecf26..49e1b7555 100644 --- a/app/models/apple/publisher.rb +++ b/app/models/apple/publisher.rb @@ -246,7 +246,7 @@ def mark_delivery_files_uploaded!(eps) def publish_drafting!(eps) Rails.logger.tagged("##{__method__}") do - eps = eps.select { |ep| ep.drafting? && ep.apple_upload_complete? } + eps = eps.select { |ep| ep.drafting? && ep.container_upload_complete? } res = Apple::Episode.publish(api, show, eps) Rails.logger.info("Published #{res.length} drafting episodes.") diff --git a/test/models/apple/publisher_test.rb b/test/models/apple/publisher_test.rb index 14665af6c..0ccb63057 100644 --- a/test/models/apple/publisher_test.rb +++ b/test/models/apple/publisher_test.rb @@ -112,7 +112,7 @@ describe "#publish_drafting!" do it "should call the episode publish drafting class method" do - ep = OpenStruct.new(drafting?: true, apple_upload_complete?: true) + ep = OpenStruct.new(drafting?: true, container_upload_complete?: true) mock = Minitest::Mock.new mock.expect(:call, [], [apple_publisher.api, apple_publisher.show, [ep]])