This commit is contained in:
2026-07-20 08:17:30 +08:00
parent 1290219077
commit 72a792d585
5 changed files with 35 additions and 19 deletions
+16
View File
@@ -55,6 +55,21 @@ async function recomputeParentDurations(lessonId) {
}
const LESSON_LIST_COMPUTED = [
{
// Not its own column — consumed by the Title cell on the frontend to
// prefix "(UNIT)" when a lesson is already attached to at least one Unit.
key: "unit_count",
label: "Unit Count",
type: "number",
hidden: true,
filterable: false,
literal: `(
SELECT CAST(COUNT(*) AS INTEGER)
FROM unit_lessons ul
JOIN units u ON u.unit_id = ul.unit_id AND u."deletedAt" IS NULL
WHERE ul.lesson_id = "Lesson"."lesson_id"
)`,
},
{
key: "course_count",
label: "Affiliated",
@@ -74,6 +89,7 @@ const LESSON_LIST_COMPUTED = [
label: "Course Status",
type: "text",
order: 3, // 1: Title, 2: Affiliated, 3: Course Status — see lessons.mdl.js
hidden: true,
filterable: false,
literal: `(
CASE