diff --git a/controllers/admin/lessons.controller.js b/controllers/admin/lessons.controller.js index 5eb6d16..3d59634 100644 --- a/controllers/admin/lessons.controller.js +++ b/controllers/admin/lessons.controller.js @@ -57,8 +57,9 @@ async function recomputeParentDurations(lessonId) { const LESSON_LIST_COMPUTED = [ { key: "course_count", - label: "Used in courses", + label: "Affiliated", type: "number", + order: 2, // 1: Title, 2: Affiliated, 3: Course Status — see lessons.mdl.js literal: `( SELECT CAST(COUNT(DISTINCT c.course_id) AS INTEGER) FROM unit_lessons ul @@ -72,6 +73,7 @@ const LESSON_LIST_COMPUTED = [ key: "course_status", label: "Course Status", type: "text", + order: 3, // 1: Title, 2: Affiliated, 3: Course Status — see lessons.mdl.js filterable: false, literal: `( CASE diff --git a/controllers/admin/units.controller.js b/controllers/admin/units.controller.js index bce7bda..2cb50cb 100644 --- a/controllers/admin/units.controller.js +++ b/controllers/admin/units.controller.js @@ -87,6 +87,7 @@ const UNIT_LIST_COMPUTED = [ key: "course_status", label: "Course Status", type: "text", + order: 3, // 1: Title, 2: Affiliated, 3: Course Status, 4: Subscription, 5: Duration — see units.mdl.js filterable: false, literal: `( CASE diff --git a/models/courses/lessons.mdl.js b/models/courses/lessons.mdl.js index dde38d4..2485bdf 100644 --- a/models/courses/lessons.mdl.js +++ b/models/courses/lessons.mdl.js @@ -8,7 +8,8 @@ const Lesson = sequelize.define("Lesson", { uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0 }, title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1 }, - description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 2 }, + // order 2 is reserved for the computed "Affiliated" (course_count) column, order 3 for computed "Course Status" — see LESSON_LIST_COMPUTED in lessons.controller.js + description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 0 }, duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0 }, // computed from blocks on save diff --git a/models/courses/units.mdl.js b/models/courses/units.mdl.js index a06dd40..f1492cc 100644 --- a/models/courses/units.mdl.js +++ b/models/courses/units.mdl.js @@ -7,10 +7,10 @@ const Unit = sequelize.define("Unit", { unit_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true, hidden: true, order: 0, filterable: false }, uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0, filterable: false }, title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1, filterable: true }, - // order 2 is reserved for the computed "Affiliated" (course_count) column — see UNIT_LIST_COMPUTED in units.controller.js - subscription: { type: DataTypes.STRING(50), allowNull: true, label: "Subscription", hidden: false, order: 3, filterable: true, comment: "Optional direct tier gate for standalone units — null means open (or gated only via an attached course)." }, + // order 2 is reserved for the computed "Affiliated" (course_count) column, order 3 for computed "Course Status" — see UNIT_LIST_COMPUTED in units.controller.js + subscription: { type: DataTypes.STRING(50), allowNull: true, label: "Subscription", hidden: false, order: 4, filterable: true, comment: "Optional direct tier gate for standalone units — null means open (or gated only via an attached course)." }, description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 0, filterable: false }, - duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0, hidden: false, order: 4, filterable: false }, + duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0, hidden: false, order: 5, filterable: false }, createdBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true }, updatedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true }, deletedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },