-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Implement PUT endpoint and UI for question editing #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this 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
Description
Summary of work:
Fixes #366
Checklist:
Before you submit your Pull Request, please make sure you have completed the following tasks: