mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
Fix PR review findings for workflow costs
This commit is contained in:
1 parent
d3ff2c43b3
commit
01f5fd4d08
3 files changed
+13
-7
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { and, desc, eq, gte, isNotNull, isNull, lt, lte, sql } from "drizzle-orm";
|
||||
import { alias } from "drizzle-orm/pg-core";
|
||||
import type { Db } from "@paperclipai/db";
|
||||
import { activityLog, agents, companies, costEvents, issues, projects } from "@paperclipai/db";
|
||||
import { notFound, unprocessable } from "../errors.js";
|
||||
@@ -135,6 +136,7 @@ export function costService(db: Db, budgetHooks: BudgetServiceHooks = {}) {
|
||||
},
|
||||
|
||||
issueTreeSummary: async (companyId: string, issueId: string) => {
|
||||
const childIssues = alias(issues, "child");
|
||||
const issueTreeCondition = sql<boolean>`
|
||||
${issues.id} IN (
|
||||
WITH RECURSIVE issue_tree(id) AS (
|
||||
@@ -144,11 +146,11 @@ export function costService(db: Db, budgetHooks: BudgetServiceHooks = {}) {
|
||||
AND ${issues.id} = ${issueId}
|
||||
AND ${issues.hiddenAt} IS NULL
|
||||
UNION
|
||||
SELECT child.id
|
||||
FROM ${issues} child
|
||||
JOIN issue_tree ON child.parent_id = issue_tree.id
|
||||
WHERE child.company_id = ${companyId}
|
||||
AND child.hidden_at IS NULL
|
||||
SELECT ${childIssues.id}
|
||||
FROM ${issues} ${childIssues}
|
||||
JOIN issue_tree ON ${childIssues.parentId} = issue_tree.id
|
||||
WHERE ${childIssues.companyId} = ${companyId}
|
||||
AND ${childIssues.hiddenAt} IS NULL
|
||||
)
|
||||
SELECT id FROM issue_tree
|
||||
)
|
||||
|
||||
@@ -475,7 +475,9 @@ export function IssueRunLedgerContent({
|
||||
items.push({
|
||||
kind: "activity",
|
||||
id: event.id,
|
||||
timestamp: String(event.createdAt),
|
||||
timestamp: event.createdAt instanceof Date
|
||||
? event.createdAt.toISOString()
|
||||
: String(event.createdAt),
|
||||
event,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -404,7 +404,9 @@ describe("NewIssueDialog", () => {
|
||||
const submitButton = Array.from(container.querySelectorAll("button"))
|
||||
.find((button) => button.textContent?.includes("Create Issue"));
|
||||
expect(submitButton).not.toBeUndefined();
|
||||
expect(submitButton?.hasAttribute("disabled")).toBe(false);
|
||||
await vi.waitFor(() => {
|
||||
expect(submitButton?.hasAttribute("disabled")).toBe(false);
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
submitButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||
|
||||
Reference in new issue
Block a user