Skip to main content
Glama
isRelevantComment.ts1.34 kB
/** * Comment Relevance Detector * * This utility determines whether an issue comment is relevant to a specific blocked period. * It analyzes the timestamp of comments relative to when an issue became blocked to identify * comments that might explain the blockage. The module implements time-based relevance rules, * considering comments made shortly before or after a blocking event as potentially explanatory. * This temporal analysis helps associate the right comments with blocked periods for more * accurate and insightful blocked time analytics. */ import type { IssueComment } from '../../../../types/comment' /** * Determines if a comment is relevant to a blocked period * (posted within 24 hours before or after the block started) * @param comment The comment to check * @param blockStartTime The timestamp when the block started * @returns True if the comment is relevant to the blocked period */ export function isRelevantComment(comment: IssueComment, blockStartTime: string): boolean { const commentDate = new Date(comment.created) const blockStartDate = new Date(blockStartTime) // Look for comments within 24 hours before or after the block started const timeDiff = Math.abs(commentDate.getTime() - blockStartDate.getTime()) const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000 return timeDiff < ONE_DAY_IN_MS }

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