Skip to content
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

refactor: introduce proper element-dependent typing for question response and instance evaluation #4327

Merged
merged 9 commits into from
Oct 21, 2024

Conversation

sjschlapbach
Copy link
Member

@sjschlapbach sjschlapbach commented Oct 20, 2024

  • Verify that response logic and loading of previous responses on microlearning works as expected

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced data handling for various question types, including new response types for flashcard, numerical, and content evaluations.
    • Improved error messages for unsupported histogram types in the user interface.
  • Bug Fixes

    • Refined evaluation handling logic for different question types, ensuring type safety and clarity.
  • Documentation

    • Updated type definitions and comments to reflect changes in the evaluation structures and response handling.

These updates enhance user experience and provide clearer feedback mechanisms throughout the application.

Copy link

aviator-app bot commented Oct 20, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@sjschlapbach
Copy link
Member Author

Replacement branch for #4325

@sjschlapbach sjschlapbach changed the base branch from v3 to v3-types October 20, 2024 19:55
Copy link

cypress bot commented Oct 20, 2024

klicker-uzh    Run #3335

Run Properties:  status check passed Passed #3335  •  git commit 3a91417aae ℹ️: Merge 470f61584482ab189cf951376b4004b3ab275e73 into 6f5cb2152c47e45b9791d9c23a70...
Project klicker-uzh
Run status status check passed Passed #3335
Run duration 11m 13s
Commit git commit 3a91417aae ℹ️: Merge 470f61584482ab189cf951376b4004b3ab275e73 into 6f5cb2152c47e45b9791d9c23a70...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 140

@sjschlapbach sjschlapbach changed the title [WIP]: refactor: introduce proper element-dependent typing for question response and instance evaluation refactor: introduce proper element-dependent typing for question response and instance evaluation Oct 20, 2024
@sjschlapbach sjschlapbach marked this pull request as ready for review October 21, 2024 10:35
Copy link

coderabbitai bot commented Oct 21, 2024

Caution

Review failed

Failed to post review comments.

📝 Walkthrough

Walkthrough

This pull request introduces a series of changes across multiple components and files, primarily focusing on enhancing type definitions and improving the handling of evaluation data within the application. Key modifications include the introduction of new types, such as NumericalQuestionData, FlashcardCorrectness, and various instance evaluation types, which replace older, more generic types. Additionally, several components are updated to utilize these new types, ensuring type safety and clarity in data handling. The changes also include updates to localization files for improved user feedback and error handling.

Changes

File Path Change Summary
apps/frontend-manage/src/components/evaluation/Chart.tsx Added import for NumericalQuestionData. Updated data prop for Histogram to include questionData with __typename set to 'NumericalQuestionData'.
apps/frontend-pwa/src/components/practiceQuiz/ElementStack.tsx Added imports for FlashcardCorrectness and FlashcardCorrectnessType. Refined response handling logic based on __typename for various evaluation types.
packages/graphql/src/graphql/ops/FStackFeedbackEvaluations.graphql Introduced new GraphQL fragment StackFeedbackEvaluations for various feedback evaluations.
packages/graphql/src/graphql/ops/MRespondToElementStack.graphql Updated mutation RespondToElementStack to reference the StackFeedbackEvaluations fragment.
packages/graphql/src/graphql/ops/QGetPreviousStackEvaluation.graphql Updated query GetPreviousStackEvaluation to reference the StackFeedbackEvaluations fragment.
packages/graphql/src/public/client.json Updated hash values for RespondToElementStack and GetPreviousStackEvaluation.
packages/graphql/src/public/schema.graphql Added multiple new types for instance evaluations and transformed existing types into union types.
packages/graphql/src/public/server.json Added new mutations and fragments, including RespondToFeedback and updates to RespondToElementStack.
packages/graphql/src/schema/practiceQuizzes.ts Updated type imports and interfaces, changing IStackFeedback to use the new InstanceEvaluationType.
packages/graphql/src/schema/question.ts Expanded type imports and redefined IQuestionFeedback as a GraphQL object type. Introduced shared properties for evaluation types and updated InstanceEvaluation to a union type.
packages/graphql/src/schema/questionData.ts Streamlined type definitions by replacing interfaces with type aliases for Choice and NumericalSolutionRange.
packages/graphql/src/schema/session.ts Added new types and interfaces for question responses. Updated QuestionResponse to a union type encompassing various response types.
packages/graphql/src/scripts/2024-05-05_compute_aggregated_results.ts Updated types for question responses to use SingleQuestionResponseChoices and SingleQuestionResponseValue.
packages/graphql/src/scripts/2024-05-07_compute_aggregated_FCCT_responses.ts Updated type assertions to use SingleQuestionResponseContent and SingleQuestionResponseFlashcard.
packages/graphql/src/scripts/2024-05-07_compute_correctness_counts_response.ts Updated types for question responses to use more specific types.
packages/graphql/src/services/practiceQuizzes.ts Restructured types for responses, replacing QuestionResponse types with more specific types for clarity.
packages/types/src/index.ts Renamed several response-related types to include SingleQuestionResponse variants and introduced new interfaces for instance evaluations.
packages/shared-components/src/ChoicesQuestion.tsx Updated evaluation prop type from InstanceEvaluation to ChoicesInstanceEvaluation.
packages/shared-components/src/Flashcard.tsx Updated types for response, setResponse, and existingResponse to use FlashcardCorrectness.
packages/shared-components/src/FreeTextQuestion.tsx Updated evaluation prop type from InstanceEvaluation to FreeTextInstanceEvaluation.
packages/shared-components/src/Histogram.tsx Modified error handling logic to indicate histogram support issues.
packages/shared-components/src/NumericalQuestion.tsx Updated evaluation prop type from InstanceEvaluation to NumericalInstanceEvaluation.
packages/shared-components/src/StudentElement.tsx Updated response type for Flashcard and refined evaluation handling for various question types.
packages/shared-components/src/evaluation/FTEvaluation.tsx Updated evaluation prop type from InstanceEvaluation to FreeTextInstanceEvaluation.
packages/shared-components/src/evaluation/MCKPRIMEvaluation.tsx Updated evaluation prop type from InstanceEvaluation to ChoicesInstanceEvaluation.
packages/shared-components/src/evaluation/NREvaluation.tsx Renamed Props interface to NREvaluationProps and updated evaluation prop type to NumericalInstanceEvaluation.
packages/shared-components/src/evaluation/SCEvaluation.tsx Updated evaluation prop type from InstanceEvaluation to ChoicesInstanceEvaluation.
packages/i18n/messages/de.ts Added new error message for unsupported histogram types.
packages/i18n/messages/en.ts Added new error message for unsupported histogram types and refined instructional text for clarity.
packages/prisma/src/prisma/schema/response.prisma Updated documentation comments for firstResponse, lastResponse, and response fields to reflect changes in expected types.

Possibly related PRs

Suggested reviewers

  • rschlaefli

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@sjschlapbach sjschlapbach merged commit 4d1421d into v3-types Oct 21, 2024
18 of 21 checks passed
@sjschlapbach sjschlapbach deleted the question-response-typing branch October 21, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant