PEP-198: часть разбивки задачи человека — «готово» сразу
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bb33d3fcca
commit
ac2881a6a6
@ -10,11 +10,14 @@ import { formatTaskKey } from "@peppa/shared";
|
||||
import { questionType, type MessageType } from "./questions.ts";
|
||||
import { getSetting, setSetting } from "./settings.ts";
|
||||
import { COMMENT_EVENT } from "./tasks.ts";
|
||||
import { splitParent } from "./task-decisions.ts";
|
||||
|
||||
/** Does a person wait for this story (its «готово» goes at once)? */
|
||||
export async function taskAwaited(db: Db, taskId: number): Promise<boolean> {
|
||||
/** Does a person wait for this story (its «готово» goes at once)? A part of a split — when its first story is awaited. */
|
||||
export async function taskAwaited(db: Db, taskId: number, depth = 0): Promise<boolean> {
|
||||
const [t] = await db.select({ origin: tasks.origin }).from(tasks).where(eq(tasks.id, taskId));
|
||||
if (!t || t.origin === "human") return true;
|
||||
const parent = depth < 3 ? await splitParent(db, taskId) : null;
|
||||
if (parent && (await taskAwaited(db, parent, depth + 1))) return true;
|
||||
const [e] = await db
|
||||
.select({ id: events.id })
|
||||
.from(events)
|
||||
|
||||
@ -124,6 +124,10 @@ describe("Готовые задачи сводкой", () => {
|
||||
// A comment makes the owner wait for the story: its «готово» goes at once.
|
||||
await core.addStoryComment(db, await core.resolveTask(db, a.key), owner, "Жду это");
|
||||
assert.equal(await heldForDigest(db, open.find((q) => q.taskId === a.task.id)!, "review"), false);
|
||||
// A part of a split of the owner's own story is awaited like the story itself.
|
||||
const part = await core.createTask(db, { projectId: p.id, title: "Часть разбивки", origin: "analyst" });
|
||||
await core.markSplitPart(db, part.task.id, human.task.id);
|
||||
assert.equal(await core.taskAwaited(db, part.task.id), true);
|
||||
delete process.env.PEPPA_READY_DIGEST;
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user