Merged
Conversation
Implemented a new question type, "Say What You See," across the application. This includes updates to UI components, data models, and serialization logic. Key changes include: - Conditional rendering for `ClientSayWhatYouSeeQuestion` in `QuestionPicker.razor`. - New button and handler for selecting the question type in `QuestionTypePickerModal.razor`. - Updated rendering logic in `RootComponent.razor`. - Enhanced question addition method to include the new type. - Registered new types for JSON serialization in `ClientAnswer.cs` and `ClientQuestion.cs`. - Updated `PolymorphicQuestionConverter.cs` for deserialization. - Created `SayWhatYouSeeQuestion` and `ClientSayWhatYouSeeAnswer` classes with validation and equality logic. - Added new Razor components for user interaction with the question type. - Implemented a custom string equality comparer for answer comparison. - Improved CSS styles for the new components. - Added unit tests to validate functionality and answer logic.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new "Say What You See" question type across models, UI, editing, and serialization logic.
- Extends server and client polymorphic serializers and models to include the new question and answer types.
- Implements Razor components and CSS for displaying, editing, and presenting the new question.
- Adds basic unit tests and updates navigation/validation logic to accommodate folder paths.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| QuizExperiment.Models/Question.cs | Added JSON discriminator for SayWhatYouSeeQuestion |
| QuizExperiment.Models/PolymorphicQuestionConverter.cs | Handled sayWhatYouSee in server‐side converter |
| QuizExperiment.Models/Client/SayWhatYouSeeStringEqualityComparer.cs | Introduced case‐insensitive string comparer |
| QuizExperiment.Models/Client/ClientSayWhatYouSeeQuestion.cs | Added client model for new question type |
| QuizExperiment.Models/Client/ClientSayWhatYouSeeAnswer.cs | Added client answer type with equality and hash‐code logic |
| QuizExperiment.Models/Client/ClientQuestion.cs | Registered client question discriminator for sayWhatYouSee |
| QuizExperiment.Models/Client/ClientAnswer.cs | Registered client answer discriminator for sayWhatYouSee |
| QuizExperiment.Models.Test/Client/ClientQuestionSerializationTests.cs | Added comparer and answer‐validation tests |
| QuizExperiment.Admin/Client/wwwroot/css/app.css | Styling for new question UI (.swys-container, .img-quiz) |
| QuizExperiment.Admin/Client/Shared/Present/SayWhatYouSeeQuestion.razor | Presentation component for the new question type |
| QuizExperiment.Admin/Client/Shared/Present/QuestionPicker.razor | Updated presenter to render "Say What You See" |
| QuizExperiment.Admin/Client/Shared/Present/QuestionAnswerChart.razor | Enhanced chart view to handle empty/fallback fastest user |
| QuizExperiment.Admin/Client/Shared/Edit/SayWhatYouSeeQuestion.razor | Editor component for new question type |
| QuizExperiment.Admin/Client/Shared/Edit/RootComponent.razor | Root editor updated with switch for new question and folder paths |
| QuizExperiment.Admin/Client/Shared/Edit/QuestionTypePickerModal.razor | Picker modal includes "Type the Answer" option |
| QuizExperiment.Admin/Client/Shared/Client/SayWhatYouSeeQuestion.razor | Client quiz UI for capturing answers |
| QuizExperiment.Admin/Client/Shared/Client/QuestionPicker.razor | Client‐side picker supports new question type |
| QuizExperiment.Admin/Client/Pages/Tests/Present/SayWhatYouSee.razor | Test page for presentation view route |
| QuizExperiment.Admin/Client/Pages/Tests/Client/SayWhatYouSeeAnswerSummary.razor | Test page for answer summary |
| QuizExperiment.Admin/Client/Pages/Tests/Client/SayWhatYouSee.razor | Test page for client UI route |
Comments suppressed due to low confidence (3)
QuizExperiment.Models/Client/ClientAnswer.cs:13
- Typo in TypeDiscriminatorPropertyName: "anwserType" should be "answerType" to ensure correct polymorphic serialization of answers.
[JsonPolymorphic(TypeDiscriminatorPropertyName = "anwserType")]
QuizExperiment.Models/Client/ClientQuestion.cs:15
- Consider adding a serialization test to verify that
ClientSayWhatYouSeeQuestionproduces the correct discriminator (questionType":"sayWhatYouSee").
[JsonDerivedType(typeof(ClientSayWhatYouSeeQuestion), "sayWhatYouSee")]
QuizExperiment.Models/PolymorphicQuestionConverter.cs:22
- There’s no existing unit test covering deserialization of the new
SayWhatYouSeeQuestiondiscriminator; consider adding one to ensure server-side converter handles it correctly.
if (type == "sayWhatYouSee")
QuizExperiment.Models/Client/SayWhatYouSeeStringEqualityComparer.cs
Outdated
Show resolved
Hide resolved
QuizExperiment.Admin/Client/Pages/Tests/Present/SayWhatYouSee.razor
Outdated
Show resolved
Hide resolved
…er.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…razor Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new question type, "Say What You See," to the quiz application. The changes span multiple files, implementing the new question type in both the client-side and server-side logic, as well as updating UI components and validation logic.
Implementation of "Say What You See" Question Type:
Client-side Question and Answer Models:
ClientSayWhatYouSeeQuestionandClientSayWhatYouSeeAnsweras derived types inClientQuestionandClientAnswerrespectively, enabling polymorphic serialization for the new question type. (QuizExperiment.Models/Client/ClientAnswer.cs,QuizExperiment.Models/Client/ClientQuestion.cs) [1] [2]UI Components for "Say What You See":
SayWhatYouSeeQuestion.razorfor displaying the question and capturing user input. Includes a text box for answers and a submit button. (QuizExperiment.Admin/Client/Shared/Client/SayWhatYouSeeQuestion.razor)SayWhatYouSeeQuestionhandling inQuestionPicker.razorfor both client and presentation contexts, enabling dynamic rendering of the new question type. (QuizExperiment.Admin/Client/Shared/Client/QuestionPicker.razor,QuizExperiment.Admin/Client/Shared/Present/QuestionPicker.razor) [1] [2]SayWhatYouSeeQuestion.razorfor the presentation view, displaying the question title, image, and countdown timer. (QuizExperiment.Admin/Client/Shared/Present/SayWhatYouSeeQuestion.razor)Enhancements to Quiz Editing and Validation:
Question Type Picker Modal:
QuizExperiment.Admin/Client/Shared/Edit/QuestionTypePickerModal.razor) [1] [2]Root Component Updates:
OnAddQuestionmethod to support creating "Say What You See" questions with default properties. (QuizExperiment.Admin/Client/Shared/Edit/RootComponent.razor)QuizExperiment.Admin/Client/Shared/Edit/RootComponent.razor)Testing and Validation:
ClientSayWhatYouSeeAnswer. (QuizExperiment.Models.Test/Client/ClientQuestionSerializationTests.cs)Miscellaneous:
QuizExperiment.Admin/Client/wwwroot/css/app.css)These changes collectively introduce a robust implementation of the "Say What You See" question type, ensuring compatibility across the quiz application while maintaining clean and modular code.
#49