feat(support): verify the manual assessment request after a C3 refusal

This commit is contained in:
shira committed 2026-10-08 21:26:00 +03:00
1 parent 6bfd7098c3
commit 68286af8b7
20 files changed
+680 -74

No files matched your search

@@ -10,6 +10,7 @@ export {
} from "./model/submission";
export {
formatSupportDate,
manualAssessmentRubricDescription,
supportCaseActorLabels,
supportCaseEventKindLabels,
supportCaseStatusLabels,
@@ -1,5 +1,9 @@
import { describe, expect, it } from "vitest";
import { supportCaseStatusLabels, supportTargetDescription } from "./presentation";
import {
manualAssessmentRubricDescription,
supportCaseStatusLabels,
supportTargetDescription,
} from "./presentation";
describe("support case presentation", () => {
it("describes operational goals without presenting them as legal deadlines", () => {
@@ -18,4 +22,44 @@ describe("support case presentation", () => {
it("labels manual assessment as waiting for an expert", () => {
expect(supportCaseStatusLabels.waiting_expert).toBe("Ожидает эксперта");
});
it("states honestly when a manual request has no pinned rubric", () => {
const copy = manualAssessmentRubricDescription(null, "waiting_expert");
expect(copy).toContain("рубрики для этой цели на момент запроса не было");
expect(copy).toContain("категория не присвоена");
expect(copy).toContain("ожидает эксперта");
});
it("shows the pinned policy version", () => {
expect(manualAssessmentRubricDescription(3, "waiting_expert")).toContain(
"версия политики оценивания 3",
);
});
it.each(["submitted", "in_review", "waiting_for_user"] as const)(
"keeps the unassigned-category note for the open status %s without the queue note",
(status) => {
const copy = manualAssessmentRubricDescription(3, status);
expect(copy).toContain("категория не присвоена");
expect(copy).not.toContain("ожидает эксперта");
},
);
it("refers a resolved case to its decision instead of claiming no category", () => {
const copy = manualAssessmentRubricDescription(null, "resolved");
expect(copy).toContain("Автоматическая оценка не выполнялась");
expect(copy).toContain("решении");
expect(copy).not.toContain("категория не присвоена");
expect(copy).not.toContain("ожидает эксперта");
});
it("does not claim an unassigned category for a closed case", () => {
const copy = manualAssessmentRubricDescription(3, "closed");
expect(copy).toContain("Автоматическая оценка не выполнялась");
expect(copy).not.toContain("категория не присвоена");
});
});
@@ -36,6 +36,33 @@ export const supportCaseActorLabels: Readonly<Record<SupportCaseActorKind, strin
system: "Система",
};
/**
* Describes the rubric pinned to a manual assessment request. A null version
* means that no single current reviewed rubric existed for the target when the
* request was created; the request is still valid and no category is assigned
* automatically. Once the case is resolved or closed the text no longer claims
* that a category is unassigned, because the expert decision may have set one.
*/
export function manualAssessmentRubricDescription(
rubricVersion: number | null,
status: SupportCaseStatus,
): string {
const rubric =
rubricVersion === null
? "Опубликованной рубрики для этой цели на момент запроса не было."
: `Зафиксирована версия политики оценивания ${rubricVersion}.`;
switch (status) {
case "resolved":
return `${rubric} Автоматическая оценка не выполнялась. Итог указан в решении.`;
case "closed":
return `${rubric} Автоматическая оценка не выполнялась. Обращение закрыто.`;
case "waiting_expert":
return `${rubric} Автоматическая оценка не выполнялась, категория не присвоена. Запрос ожидает эксперта.`;
default:
return `${rubric} Автоматическая оценка не выполнялась, категория не присвоена.`;
}
}
export function formatSupportDate(value: string): string {
const date = new Date(value);
if (Number.isNaN(date.valueOf())) return value;