Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ export const getCreatedInterview = async (interviewId: number, params: CreateInt
const response = await apiInstance.get("/api/interviews/get", { params: { interviewId }, signal, timeout: 15_000 });
const data = normalizeCreatedInterview(response.data, params);
if (!data || data.interviewId !== interviewId) throw new Error("면접 정보를 확인하지 못했습니다.");
// 서버가 N:1 면접관을 기술 면접관 먼저로 재정렬하므로 순서는 비교하지 않는다.
if ("personaIds" in params && (params.personaIds.length !== data.personaIds.length ||
params.personaIds.some((id, index) => data.personaIds[index] !== id))) {
params.personaIds.some((id) => !data.personaIds.includes(id)))) {
Comment on lines 224 to +225

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve persona-to-slot mapping after accepting reordered IDs

When the server returns the same persona IDs in a different order—the exact N:1 scenario this change now accepts—the returned data.personaIds remains in server order. buildPreparedView later pairs those IDs by index with the original settings.slots (prepareView.ts:22-25), so questions from one persona highlight and display another interviewer's name, role, image, and traits. After validating set equality, restore the request order or explicitly map each ID to its originating slot before returning the data.

Useful? React with 👍 / 👎.

throw new Error("생성된 면접관 정보가 선택한 설정과 일치하지 않습니다.");
}
return data;
Expand Down
10 changes: 6 additions & 4 deletions tests/profile-preparation.browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ async function fixture(options = {}) {
mode: request.postDataJSON().personaIds ? "MULTI" : "SOLO", status: "IN_PROGRESS",
} });
if (pathname === "/api/interviews/get") return json({ data: {
interviewId: 42, sessionId: "test-session", userId: 7, personaId: 1, personaIds: state.createdPersonaIds,
// reversePersonas: 서버가 N:1 면접관을 기술 면접관 먼저로 재정렬해 돌려주는 경우
interviewId: 42, sessionId: "test-session", userId: 7, personaId: 1,
personaIds: state.reversePersonas ? [...state.createdPersonaIds].reverse() : state.createdPersonaIds,
mode: state.createdPersonaIds.length > 1 ? "MULTI" : "SOLO", status: "IN_PROGRESS", questions: [],
} });
if (pathname === "/api/interviews/42") return state.start404 ? json({ message: "포트폴리오 분석을 먼저 진행해주세요" }, 404) : json({ data: { interviewId: 42, sessionId: "test-session" } });
Expand Down Expand Up @@ -264,8 +266,8 @@ try {
}
}

for (const path of ["/main/setting/interview", "/main/setting/interview/multi"]) {
const f = await fixture({ start404: true, preparation: preparation("NOT_REQUESTED") });
for (const [path, reversePersonas] of [["/main/setting/interview", false], ["/main/setting/interview/multi", false], ["/main/setting/interview/multi", true]]) {
const f = await fixture({ start404: true, preparation: preparation("NOT_REQUESTED"), reversePersonas });
await f.navigate(path);
const next = f.page.getByRole("button", { name: "다음: 기업 선택", exact: true });
await expectEnabled(next, true);
Expand All @@ -282,7 +284,7 @@ try {
await f.page.getByText("포트폴리오 분석을 먼저 진행해주세요", { exact: true }).waitFor();
assert.equal(await f.page.getByRole("link", { name: "마이페이지로 이동", exact: true }).count(), 1);
await f.close();
report(`${path}: start 404 links to materials`);
report(`${path}: start 404 links to materials${reversePersonas ? " (server reorders personas)" : ""}`);
}

const waiting = await fixture({ preparation: preparation("PREPARING", { chatDelivered: true, retryAfterMs: 4_500 }) });
Expand Down