Dubbing Review Status Propagation
Problem statement
A dubbing project contains script lines grouped into media files. Every line starts PENDING. Process commands:
APPROVE lineIdsets the line toAPPROVED.REQUEST_CHANGES lineIdsets it toCHANGES_REQUESTED.RERECORD lineIdsets it toNEEDS_REVIEW, even if it was previously approved.FILE fileIdreports the file roll-up.
Each mutation contributes its resulting line status. A FILE command contributes CHANGES_REQUESTED if any line has that status, otherwise NEEDS_REVIEW if any line does, otherwise PENDING if any line does, and otherwise APPROVED.
Function
processDubbingReviews(lineIds: String[], fileIds: String[], operations: String[]) → String[]Examples
Example 1
lineIds = ["L1","L2"]fileIds = ["F","F"]operations = ["FILE F","APPROVE L1","APPROVE L2","FILE F","RERECORD L1","FILE F"]return = ["PENDING","APPROVED","APPROVED","APPROVED","NEEDS_REVIEW","NEEDS_REVIEW"]A re-recorded approved line makes the file need review again.
Example 2
lineIds = ["A","B","C"]fileIds = ["X","X","Y"]operations = ["APPROVE A","REQUEST_CHANGES B","FILE X","FILE Y"]return = ["APPROVED","CHANGES_REQUESTED","CHANGES_REQUESTED","PENDING"]Changes requested take precedence in X, while Y remains pending.
Constraints
1 <= lineIds.length = fileIds.length <= 100000- Line IDs are unique and every command references a known line or file.
1 <= operations.length <= 100000