mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
15 lines
589 B
TypeScript
15 lines
589 B
TypeScript
import type { Issue } from "@paperclipai/shared";
|
|
import type { ActiveRunForIssue } from "../api/heartbeats";
|
|
|
|
export function shouldTrackIssueActiveRun(
|
|
issue: Pick<Issue, "status" | "executionRunId"> | null | undefined,
|
|
): boolean {
|
|
return Boolean(issue && (issue.status === "in_progress" || issue.executionRunId));
|
|
}
|
|
|
|
export function resolveIssueActiveRun(
|
|
issue: Pick<Issue, "status" | "executionRunId"> | null | undefined,
|
|
activeRun: ActiveRunForIssue | null | undefined,
|
|
): ActiveRunForIssue | null {
|
|
return shouldTrackIssueActiveRun(issue) ? (activeRun ?? null) : null;
|
|
}
|