Skip to content

feat(Grading Tool): Teacher Reflection Questions - #364

Merged
hirokiterashima merged 4 commits into
developfrom
feat/teacher-reflection-questions
Oct 14, 2026
Merged

hirokiterashima merged 4 commits into
developfrom
feat/teacher-reflection-questions

Conversation

@hirokiterashima

Copy link
Copy Markdown
Member

Overview

This PR introduces the backend support for Teacher Reflection Questions. It allows teachers to retrieve reflection questions configured for a step component in a run/period and submit answers associated with their teacher workgroup.

Changes

1. Database Migration

  • Flyway Migration (V3__create_teacher_reflections_table.sql):
    • Created teacher_reflections table to persist reflection questions and answers.
    • Columns: id, runId, periodId, nodeId, componentId, componentType, questionId, questionText, answerText, answeredByWorkgroupId, createdAt, updatedAt.
    • Added unique constraint teacherReflectionsUniqueKey on (runId, periodId, nodeId, componentId, questionId).
    • Added foreign key constraints to runs(id), groups(id), and workgroups(id).
    • Added index on runId.

2. Domain & Data Access

  • TeacherReflection.java:
    • JPA Entity representing the reflection model with lazy-loaded mappings to Run, Group (period), and Workgroup.
  • TeacherReflectionDao.java & HibernateTeacherReflectionDao.java:
    • Added data access methods:
      • getQuestions(Run, Group, String nodeId, String componentId): Retrieves all reflection entries for a given component in a run period.
      • getQuestion(Run, Group, String nodeId, String componentId, String questionId): Retrieves a specific reflection question entry.

3. Service Layer

  • TeacherReflectionService.java & TeacherReflectionServiceImpl.java:
    • Implemented transactional methods for retrieving questions and upserting answers (saveAnswer).
    • Added validations for identifiers, question text (max 5,000 chars), answer text (max 20,000 chars), and non-null teacher workgroups.

4. REST API Controller

  • TeacherReflectionAPIController.java:
    • Base path: /api/teacher/reflection secured with @PreAuthorize("hasRole('ROLE_TEACHER')").
    • Endpoints:
      • GET /api/teacher/reflection: Fetches reflection entries for a run, period, node, and component. Requires permission to view student work.
      • PUT /api/teacher/reflection/answer: Saves/updates a reflection question answer. Requires grading permissions, validates that the period and workgroup belong to the run, and verifies the workgroup is a teacher workgroup.

5. Automated Tests

  • HibernateTeacherReflectionDaoTest.java:
    • Integration tests for DAO creation, retrieval, updating, and constraint verification.
  • TeacherReflectionServiceImplTest.java:
    • Unit tests covering delegation to DAO, upsert logic, and parameter validation.
  • TeacherReflectionAPIControllerTest.java:
    • Unit tests covering permissions checks, validation errors (400 Bad Request), and successful request/response mapping.

Test

Note: Test with WISE-Community/WISE-Client#2352. Follow the testing instruction there.

  • Ran all relevant test suites:
    mvn test -Dtest=TeacherReflectionAPIControllerTest,TeacherReflectionServiceImplTest,HibernateTeacherReflectionDaoTest

@breity breity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hirokiterashima
hirokiterashima merged commit b03f8af into develop Oct 14, 2026
2 checks passed
@hirokiterashima
hirokiterashima deleted the feat/teacher-reflection-questions branch October 14, 2026 21:09
@hirokiterashima

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 1.26.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants