4.2 KiB
Class Task Allocation Names Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Make the teacher task-allocation table display each selected teaching class's edited training-task names while keeping publication selection keyed by taskKey.
Architecture: The task-allocation view will load task rows through the existing class-scoped training-task API after a teaching class is selected. The API already applies the class override over the school default. Only the table's data source changes; publication state and save payloads continue to use taskKey.
Tech Stack: Vue 3 Composition API, Vite, Node.js static contract tests using assert.
Global Constraints
- Only task names are synchronized; selection range, selection state, sort order, and saved publication keys must remain unchanged.
- Use the selected teaching class only; never substitute data from another class after a request failure.
- Continue saving publication entries as
taskKeyvalues inmodule.
File Structure
- Modify
src/views/teacherEnd/task/index.vue: load the table's task rows from the selected teaching class and retain its current key-based publication behavior. - Modify
tests/task-publication.static.test.cjs: assert the class-scoped API is imported and is used during selected-class loading.
Task 1: Load task names by teaching class
Files:
- Modify:
tests/task-publication.static.test.cjs - Modify:
src/views/teacherEnd/task/index.vue:35-121
Interfaces:
-
Consumes:
listClassTrainingTasks(teachingClassId, { enabledOnly: false })fromsrc/api/trainingTask.js, returning{ data: TrainingTask[] }withtaskKeyand class-resolvedtaskName. -
Consumes:
indexApi.getTaskPublication({ classId }), returning{ data: { configured: boolean, taskKeys: string[] } }. -
Produces:
tasks.value, whose task rows contain the selected class'staskName;selectedTaskKeys.value, whose entries remaintaskKeystrings. -
Step 1: Write the failing contract test
Add these assertions to tests/task-publication.static.test.cjs immediately after the existing listTrainingTasks assertion:
assert(taskPage.includes("listClassTrainingTasks"), "task allocation must load training tasks for the selected teaching class");
assert(taskPage.includes("await listClassTrainingTasks(classId.value, { enabledOnly: false })"), "class task loading must request disabled and enabled tasks");
- Step 2: Run the contract test and verify it fails
Run: node tests/task-publication.static.test.cjs
Expected: AssertionError stating that task allocation must load training tasks for the selected teaching class.
- Step 3: Implement class-scoped task loading
In src/views/teacherEnd/task/index.vue:
- Replace the
listTrainingTasksimport withlistClassTrainingTasks. - Replace the parameterless default-task loader with:
async function loadTasks() {
if (!classId.value) {
tasks.value = [];
return;
}
const res = await listClassTrainingTasks(classId.value, { enabledOnly: false });
tasks.value = res.data || [];
}
- At the start of
loadPublication, after the empty-class guard, callawait loadTasks()before reading publication state so table rows are refreshed for every class switch. - In
onMounted, load classes first, then callloadPublication; remove the parallel default-task request because the selected class loader supplies the task rows.
Do not change applySelection, handleSelectionChange, or savePublication; they must continue to operate on task.taskKey.
- Step 4: Run the contract test and verify it passes
Run: node tests/task-publication.static.test.cjs
Expected: task publication front-end contract passed.
- Step 5: Build the frontend
Run: npm run build:prod
Expected: Vite completes successfully and emits the production bundle without Vue compilation errors.
- Step 6: Commit the implementation
git add tests/task-publication.static.test.cjs src/views/teacherEnd/task/index.vue
git commit -m "feat: show class task names in allocation"