Skip to content

Conversation

@thaivinhle
Copy link

@thaivinhle thaivinhle commented Nov 20, 2025

Description

Summary of work:

  • Implemented the PUT /courses/:course_id/questions/:question_id API endpoint in core/.
  • Implemented the updateQuestion function and dispatched the updateQuestionInLecture Redux action in SingleQuestionTeacher.jsx.
  • Fixed the build failure by defining the updateQuestionInLecture Redux action.
  • Resolved navigation bug in QuestionCard.jsx to allow access to the edit form.

Fixes #366

Checklist:

Before you submit your Pull Request, please make sure you have completed the following tasks:

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.
  • I have tagged my PR with the appropriate label(s).

@thaivinhle thaivinhle requested review from a team as code owners November 20, 2025 21:26
@MigrainePanda MigrainePanda added the development Updates and modifications to development/deployment tools label Nov 20, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why you removed the {!sectionId && ( part. Was something wrong with this?

Copy link
Author

Choose a reason for hiding this comment

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

The {!sectionId && ...} conditional was preventing the "View/Edit Question" button from appearing when teachers viewed questions in a section context (URL: /sections/:sectionId/lectures/:lectureId).

This meant teachers could only edit questions when viewing them at the course level, not from within sections. Since editing a question is a course-level operation (the backend PUT endpoint is /courses/:courseId/questions/:questionId and doesn't require a sectionId), teachers should be able to edit questions regardless of where they're viewing them from.

The fix removes this conditional so the edit button is always visible to teachers, while keeping the section-specific "Publish Question" toggle properly gated behind {sectionId && props.lecturePublished && ...}.

This way we maintain proper separation of concerns: editing is always available (course-level operation), while publishing is only available in the appropriate context (section-specific operation).

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. That's good.

Copy link
Contributor

@LaserBread LaserBread left a comment

Choose a reason for hiding this comment

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

Most of the code looks very good. However, would you mind adding some test cases for your core/app/api/questions.js? I can totally help if you need it.

Also check my comment in the commit

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in classroom-polling Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development Updates and modifications to development/deployment tools

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Leftover TODO: Update to props in the SingleQuestionTeacher component

4 participants