Skip to content

Commit 0f221f4

Browse files
committed
PR_26171_017 Game Journey actionable insights
1 parent ff084d3 commit 0f221f4

2 files changed

Lines changed: 27 additions & 5 deletions

File tree

tests/playwright/tools/GameJourneyTool.spec.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,9 @@ test("Game Journey progress dashboard summarizes completion metrics", async ({ p
289289
"Completion is low because no planned items are complete yet.",
290290
"4 sections are inactive, so they are visible as planning context but not active focus areas.",
291291
"Idea is one of the most complete areas with 0 of 4 planned items complete.",
292-
"Idea needs attention with 0 of 4 planned items complete.",
293-
"Mark a section item complete to move overall progress above 0%.",
292+
"Idea needs attention: complete one planned item or adjust the planned count if the scope changed.",
293+
"Next focus: Create, Design, and Graphics. Complete one small item in each area before expanding the plan.",
294+
"Next action: mark one finished section item complete so overall progress can rise above 0%.",
294295
]);
295296
await expect(page.locator("[data-journey-recommended-target]")).toHaveCount(4);
296297
await expect(page.locator("[data-journey-recommended-target='heroes'] td").nth(0)).toHaveText("Heroes");

toolbox/game-journey/game-journey.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,20 @@ function normalizeTargetCount(value) {
853853
return Math.max(0, Math.trunc(parsed));
854854
}
855855

856+
function formatAreaList(names) {
857+
if (names.length <= 1) {
858+
return names[0] || "";
859+
}
860+
if (names.length === 2) {
861+
return `${names[0]} and ${names[1]}`;
862+
}
863+
return `${names.slice(0, -1).join(", ")}, and ${names.at(-1)}`;
864+
}
865+
856866
function completionInsightMessages(snapshot, records, mostComplete, leastComplete) {
857867
const messages = [];
858868
if (!snapshot?.plannedCount) {
859-
messages.push("Completion is low because no planned section targets are available yet.");
869+
messages.push("Completion is low because no planned section targets are available yet. Next action: add suggested targets for the areas this game needs.");
860870
return messages;
861871
}
862872

@@ -879,10 +889,21 @@ function completionInsightMessages(snapshot, records, mostComplete, leastComplet
879889
}
880890
const weakest = leastComplete.find((metric) => metric.plannedCount > 0);
881891
if (weakest) {
882-
messages.push(`${weakest.bucketName} needs attention with ${weakest.completedCount} of ${weakest.plannedCount} planned items complete.`);
892+
messages.push(`${weakest.bucketName} needs attention: complete one planned item or adjust the planned count if the scope changed.`);
893+
}
894+
const lowProgressAreas = records
895+
.filter((metric) => metric.active && metric.plannedCount > 0 && metric.percentComplete < 50)
896+
.sort((left, right) =>
897+
left.percentComplete - right.percentComplete ||
898+
left.completedCount - right.completedCount ||
899+
left.bucketKey.localeCompare(right.bucketKey),
900+
)
901+
.slice(0, 3);
902+
if (lowProgressAreas.length) {
903+
messages.push(`Next focus: ${formatAreaList(lowProgressAreas.map((metric) => metric.bucketName))}. Complete one small item in each area before expanding the plan.`);
883904
}
884905
if (records.every((metric) => metric.completedCount === 0)) {
885-
messages.push("Mark a section item complete to move overall progress above 0%.");
906+
messages.push("Next action: mark one finished section item complete so overall progress can rise above 0%.");
886907
}
887908
return messages;
888909
}

0 commit comments

Comments
 (0)