"""Release correction logic.""" from ddex_ingester_common.constants.ddex_providers import ( RELEASE_CORRECTION_PROVIDERS) from ddex_ingester_common.constants.status import IN_CONTENT from ddex_ingester_common.constants.swb_deal_types import FOR_DISTRIBUTION from ddex_ingester_common.models.state_machine.body import ( Body as StateMachineContext) def is_release_correction( context: StateMachineContext, check_nfd: bool = True): """Check if a product needs to go through release correction.""" if not check_nfd: return ( context.product.status == IN_CONTENT and context.ddex_provider in RELEASE_CORRECTION_PROVIDERS ) return ( context.product.status == IN_CONTENT and context.ddex_provider in RELEASE_CORRECTION_PROVIDERS and context.product.not_for_distribution == FOR_DISTRIBUTION )