Skip to content

add say what you see question type#52

Merged
fortunkam merged 5 commits intomainfrom
feature/say_what_you_see_question_type
Jun 16, 2025
Merged

add say what you see question type#52
fortunkam merged 5 commits intomainfrom
feature/say_what_you_see_question_type

Conversation

@fortunkam
Copy link
Copy Markdown
Owner

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:

    • Added ClientSayWhatYouSeeQuestion and ClientSayWhatYouSeeAnswer as derived types in ClientQuestion and ClientAnswer respectively, 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":

    • Created SayWhatYouSeeQuestion.razor for displaying the question and capturing user input. Includes a text box for answers and a submit button. (QuizExperiment.Admin/Client/Shared/Client/SayWhatYouSeeQuestion.razor)
    • Added SayWhatYouSeeQuestion handling in QuestionPicker.razor for 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]
    • Implemented SayWhatYouSeeQuestion.razor for 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:

    • Added a new button for selecting "Say What You See" questions in the modal, along with corresponding logic to handle the selection. (QuizExperiment.Admin/Client/Shared/Edit/QuestionTypePickerModal.razor) [1] [2]
  • Root Component Updates:

    • Modified OnAddQuestion method to support creating "Say What You See" questions with default properties. (QuizExperiment.Admin/Client/Shared/Edit/RootComponent.razor)
    • Adjusted navigation logic to include folder paths when saving and presenting questions. (QuizExperiment.Admin/Client/Shared/Edit/RootComponent.razor)

Testing and Validation:

  • Unit Tests:
    • Added tests for case-insensitive comparison of answers and validation logic for ClientSayWhatYouSeeAnswer. (QuizExperiment.Models.Test/Client/ClientQuestionSerializationTests.cs)

Miscellaneous:

  • Styling Updates:
    • Added CSS classes for styling "Say What You See" components, including the image and container layout. (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

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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ClientSayWhatYouSeeQuestion produces 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 SayWhatYouSeeQuestion discriminator; consider adding one to ensure server-side converter handles it correctly.
if (type == "sayWhatYouSee")

fortunkam and others added 2 commits June 16, 2025 10:12
…er.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…razor

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@fortunkam fortunkam merged commit 5569b1b into main Jun 16, 2025
5 checks passed
@fortunkam fortunkam deleted the feature/say_what_you_see_question_type branch June 16, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants