Skip to main content
Glama
calculateHoursPerStatus.ts1.22 kB
/** * Status Hours Calculator * * This module calculates the number of hours an issue has spent in each workflow status. * It processes the issue's status transition history and computes the duration spent in * each state. This information is crucial for identifying workflow bottlenecks, optimizing * process efficiency, and providing insights into how time is distributed across different * stages of the development lifecycle. */ import { calculateHoursBetween } from './utils/dateUtils' import type { StatusPeriod } from './types/durationAssessment.types' /** * Calculates hours spent in each status based on periods * @param statusPeriods Array of status periods * @returns Record mapping status names to hours spent */ export function calculateHoursPerStatus(statusPeriods: StatusPeriod[]): Record<string, number> { const hoursInStatus: Record<string, number> = {} for (const period of statusPeriods) { const status = period.status const endTime = period.endTime || new Date().toISOString() const hours = calculateHoursBetween(period.startTime, endTime) // Add hours to the total for this status hoursInStatus[status] = (hoursInStatus[status] || 0) + hours } return hoursInStatus }

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