Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: hide legacy Partner notebook synthetic session links

Bingxi Zhao (Frank)430611022566
diff --git a/web/components/space/question-bank/QuestionCard.tsx b/web/components/space/question-bank/QuestionCard.tsx
index d126973b4..c44f8197f 100644
--- a/web/components/space/question-bank/QuestionCard.tsx
+++ b/web/components/space/question-bank/QuestionCard.tsx
@@ -190,12 +190,20 @@ export default function QuestionCard({
const badge = resultBadge(entry);
const showReviewState =
!!entry.practice?.is_mistake || mistakesOnly || result === "incorrect" || result === "partial";
+ const hasConversationSession =
+ !!entry.session_id &&
+ !entry.session_id.startsWith("reading-notebook:") &&
+ !entry.session_id.startsWith("partner-notebook:");
const independentProvenance =
- !entry.session_id &&
+ !hasConversationSession &&
entry.source !== "book" &&
entry.source !== "immersive_reading" &&
entry.source !== "mastery_path"
- ? entry.material_title || entry.section_title || entry.origin_ref || ""
+ ? entry.material_title ||
+ entry.section_title ||
+ (entry.source === "partner_chat" ? entry.session_title : "") ||
+ entry.origin_ref ||
+ ""
: "";
return (
@@ -469,9 +477,7 @@ export default function QuestionCard({
</button>
</span>
))}
- {entry.session_id &&
- entry.source !== "import" &&
- !entry.session_id.startsWith("reading-notebook:") && (
+ {hasConversationSession && entry.source !== "import" && (
<Link
href={
entry.source === "mastery_path" && (entry.mastery_path_id || entry.material_id)
diff --git a/web/tests/practice-display-stats.spec.tsx b/web/tests/practice-display-stats.spec.tsx
index e7cfea453..930e56d91 100644
--- a/web/tests/practice-display-stats.spec.tsx
+++ b/web/tests/practice-display-stats.spec.tsx
@@ -151,6 +151,46 @@ it("shows independent provenance without inventing an original-session link", ()
expect(screen.getByText("lesson.csv")).toBeVisible();
});
+it("keeps legacy Partner notebook entries readable without a synthetic chat link", () => {
+ const entry = {
+ id: 3,
+ question: "A Partner question",
+ question_type: "short",
+ options: {},
+ correct_answer: "A",
+ user_answer: "B",
+ result: "incorrect",
+ source: "partner_chat",
+ origin_type: "conversation",
+ origin_ref: "partner-notebook:p1:admin",
+ session_id: "partner-notebook:p1:admin",
+ session_title: "Tutor (Partner)",
+ categories: [],
+ created_at: 100,
+ updated_at: 100,
+ } as unknown as NotebookEntry;
+ render(
+ <ul>
+ <QuestionCard
+ entry={entry}
+ categories={[]}
+ selected={false}
+ disabled={false}
+ onToggleSelected={vi.fn()}
+ onToggleBookmark={vi.fn()}
+ onToggleResolved={vi.fn()}
+ onDelete={vi.fn()}
+ onFile={vi.fn()}
+ onUnfile={vi.fn()}
+ onCreateAndFile={vi.fn()}
+ />
+ </ul>
+ );
+
+ expect(screen.queryByRole("link", { name: "Tutor (Partner)" })).not.toBeInTheDocument();
+ expect(screen.getByText("Tutor (Partner)")).toBeVisible();
+});
+
it("switches metrics and charts without losing course scope and exposes exact daily values", async () => {
const { rerender } = render(<PracticeInsights courseId="course-a" revision={0} />);
await screen.findByText("Mastery Path");