Blocked work review
Request
Juniper Media needs a team review priority based on its current queue.
Data
Parallel id, minute, ready, and team arrays describe fictional queue rows. Blank ids and negative minutes are invalid.
Decision rule
Review the team with the most valid blocked minutes. Break ties alphabetically. Return the recommendation and its checked total.
Juniper Media, a fictional production desk, must choose which team to review first. Its rule is explicit: rank teams by valid blocked minutes, with alphabetical team names breaking ties. You will inspect the incoming rows, remove invalid identifiers and negative durations, calculate blocked work, and check the final recommendation. A ready row contributes nothing to the blocked total. A zero-minute row is valid and can still establish a blocked team with zero minutes. The five steps continue from your prior work and end in a returned recommendation with its supporting total. Follow the stated rule rather than making up a commercial value or a performance claim.
type QueueRow = {id:string;minutes:number;ready:boolean;team:string};
function validRows(ids:string[],minutes:number[],ready:boolean[],teams:string[]):QueueRow[] { return ids.map((id,index)=>({id,minutes:minutes[index],ready:ready[index],team:teams[index]})).filter(row=>row.id.trim() !== "" && row.minutes >= 0); }
function blockedTotals(rows:QueueRow[]):Map<string,number> { const totals = new Map<string,number>(); for(const row of rows) if(!row.ready) totals.set(row.team,(totals.get(row.team) ?? 0)+row.minutes); return totals; }
function largestBlocked(totals:Map<string,number>):[string,number]|undefined { return [...totals].sort((a,b)=>b[1]-a[1] || (a[0]<b[0]?-1:a[0]>b[0]?1:0))[0]; }
function solve(ids:string[],minutes:number[],ready:boolean[],teams:string[]):string[] { return ["rows", String(ids.length)]; }
If audio has 12 valid blocked minutes and video has 8, the checked answer is ["review:audio", "blocked-minutes:12"].