Skip to main content
Glama
processBlockedTransition.ts1.79 kB
/** * Blocked Transition Processor * * This module processes transitions of Jira issues into and out of blocked states. * It analyzes each status change to determine if an issue has become blocked or unblocked, * and updates the issue's blocked periods accordingly. The processor handles the logic for * starting new blocked periods and terminating existing ones, ensuring accurate tracking * of when issues were impeded during their lifecycle. This information is essential for * calculating accurate blocked time metrics and understanding workflow impediments. */ import { endBlockedPeriod } from './endBlockedPeriod' import { isBlockedStatus } from './isBlockedStatus' import { startBlockedPeriod } from './startBlockedPeriod' import type { BlockedPeriod, StatusTransition } from './types/durationAssessment.types' /** * Process a single transition to track blocked periods * @param blockedPeriods Array of blocked periods * @param currentBlockedPeriod Current blocked period (if any) * @param transition The transition to process * @returns Updated current blocked period */ export function processBlockedTransition( blockedPeriods: BlockedPeriod[], currentBlockedPeriod: BlockedPeriod | null, transition: StatusTransition, ): BlockedPeriod | null { const status = transition.toStatus const timestamp = transition.timestamp if (!status) { return currentBlockedPeriod } const isBlocked = isBlockedStatus(status) if (isBlocked && !currentBlockedPeriod) { // Start of a blocked period return startBlockedPeriod(timestamp) } if (!isBlocked && currentBlockedPeriod) { // End of a blocked period const updatedPeriod = endBlockedPeriod(currentBlockedPeriod, timestamp) blockedPeriods.push(updatedPeriod) return null } return currentBlockedPeriod }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tbreeding/jira-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server