Skip to content

Commit

Permalink
Dig for the current episode publishing state
Browse files Browse the repository at this point in the history
  • Loading branch information
svevang committed Oct 3, 2023
1 parent a80d881 commit bfce4b1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/models/apple/episode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def self.alter_publish_state(api, show, episodes, state)
episodes.map { |e| e.publishing_state_bridge_params(state) })

join_on_apple_episode_id(episodes, episode_bridge_results).each do |(ep, row)|
Rails.logger.info("Moving episode to #{state} state", {episode_id: ep.feeder_id, state: state})
Rails.logger.info("Moving episode to #{state} state", {episode_id: ep.feeder_id, state: ep.publishing_state})
end

# We don't get back the full episode model in the response.
Expand Down Expand Up @@ -416,12 +416,16 @@ def apple_persisted?
apple_json.present?
end

def publishing_state
apple_json&.dig("attributes", "publishingState")
end

def drafting?
apple_json&.dig("attributes", "publishingState") == "DRAFTING"
publishing_state == "DRAFTING"
end

def archived?
apple_json&.dig("attributes", "publishingState") == "ARCHIVED"
publishing_state == "ARCHIVED"
end

def container_upload_complete?
Expand Down

0 comments on commit bfce4b1

Please sign in to comment.