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

fix(packages/graphql): ensure that live quiz evaluation for free text questions without sample solution does not break #4415

Merged
merged 5 commits into from
Dec 27, 2024

Conversation

sjschlapbach
Copy link
Member

@sjschlapbach sjschlapbach commented Dec 27, 2024

Summary by CodeRabbit

  • New Features

    • Updated CSV filename format for student activity performance reports.
    • Enhanced visual feedback for active navigation items in the header.
  • Bug Fixes

    • Improved error handling during solution parsing in the grading process.
  • Tests

    • Added new test cases for handling edge cases in the grading function related to the solutions parameter.
  • Chores

    • Clarified variable initialization for better readability in the response processing logic.
    • Adjusted layout behavior of multiple sidebar components to occupy full height of their parent containers.

Copy link

aviator-app bot commented Dec 27, 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.

Copy link

coderabbitai bot commented Dec 27, 2024

Warning

Rate limit exceeded

@sjschlapbach has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 97760e0 and 9e04b4c.

📒 Files selected for processing (1)
  • packages/grading/test/index.test.ts (1 hunks)
📝 Walkthrough

Walkthrough

This pull request encompasses changes across multiple files in the frontend, function response processor, and grading packages. The modifications include updating the CSV filename generation in the StudentActivityPerformance component, enhancing navigation item styling in the Header component, initializing a variable in the response processor, modifying the GradeQuestionFreeTextArgs interface to support undefined/null solutions, and adding test cases for the gradeQuestionFreeText function. Additionally, error handling improvements were made in the getCachedBlockResults function and layout adjustments were implemented in several sidebar components.

Changes

File Change Summary
apps/frontend-manage/src/components/analytics/performance/StudentActivityPerformance.tsx Updated CSV filename to include _performance suffix
apps/frontend-manage/src/components/common/Header.tsx Added div wrapper for navigation items with conditional underline styling
apps/func-response-processor/src/index.ts Explicitly initialized parsedSolutions as undefined
packages/grading/src/index.ts Modified GradeQuestionFreeTextArgs interface to allow undefined or null for solutions
packages/grading/test/index.test.ts Added test cases for gradeQuestionFreeText with empty/undefined/null solutions
packages/graphql/src/services/liveQuizzes.ts Enhanced error handling for solution parsing and grading
apps/frontend-manage/src/components/evaluation/elements/ChoicesSidebar.tsx Changed layout class to allow full height
apps/frontend-manage/src/components/evaluation/elements/FTSidebar.tsx Changed layout class to allow full height
apps/frontend-manage/src/components/evaluation/elements/NRSidebar.tsx Changed layout class to allow full height

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/frontend-manage/src/components/common/Header.tsx (2)

80-87: Refine active item styling for improved user clarity.

Wrapping the label in a div and conditionally applying the underline class is a clear and maintainable way to highlight active navigation items.


96-96: Remove repeated styling logic.

The direct assignment of a base class in label is simpler, but ensure consistency across all navigation items. Consider whether you need conditional styling here as well.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b19612 and 052685b.

📒 Files selected for processing (6)
  • apps/frontend-manage/src/components/analytics/performance/StudentActivityPerformance.tsx (1 hunks)
  • apps/frontend-manage/src/components/common/Header.tsx (2 hunks)
  • apps/func-response-processor/src/index.ts (1 hunks)
  • packages/grading/src/index.ts (1 hunks)
  • packages/grading/test/index.test.ts (1 hunks)
  • packages/graphql/src/services/liveQuizzes.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • apps/frontend-manage/src/components/analytics/performance/StudentActivityPerformance.tsx
  • apps/func-response-processor/src/index.ts
🔇 Additional comments (6)
packages/grading/src/index.ts (1)

111-111: Allowing solutions to be undefined or null is beneficial for edge cases.

This change makes the GradeQuestionFreeTextArgs interface more flexible. It prevents potential runtime errors for free text questions that do not have sample solutions.

packages/grading/test/index.test.ts (3)

186-192: Edge case coverage for empty solutions array.

Awarding full points (1) when solutions is an empty array is consistent with the new requirement. This test ensures no solution scenario is handled without crashing.


193-198: Edge case coverage for undefined solutions.

Testing undefined solutions validates that the grading logic handles missing data gracefully. Great addition for completeness.


199-203: Edge case coverage for null solutions.

Same reasoning as with undefined; ensures no unexpected error occurs even if solutions is explicitly set to null.

packages/graphql/src/services/liveQuizzes.ts (2)

141-153: Add robust solution parsing with fallback on empty array.

Using a try/catch block to parse JSON prevents runtime errors when sample solutions are unavailable or malformed. Logging the error and defaulting to an empty array is a solid recovery strategy.


155-155: Check solutions length only if it exists.

The new solutions && solutions.length > 0 check aligns with the updated interface, preventing null/undefined from breaking the grading logic.

Copy link

cypress bot commented Dec 27, 2024

klicker-uzh    Run #3845

Run Properties:  status check passed Passed #3845  •  git commit a4e3d026da ℹ️: Merge 9e04b4cf20f103da9725a34148023416665ae990 into 2b196127b74fcd344ef824a54d03...
Project klicker-uzh
Branch Review ft-live-quiz-fix
Run status status check passed Passed #3845
Run duration 12m 10s
Commit git commit a4e3d026da ℹ️: Merge 9e04b4cf20f103da9725a34148023416665ae990 into 2b196127b74fcd344ef824a54d03...
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 148
View all changes introduced in this branch ↗︎

@sjschlapbach sjschlapbach merged commit 5ca0d5f into v3 Dec 27, 2024
16 checks passed
@sjschlapbach sjschlapbach deleted the ft-live-quiz-fix branch December 27, 2024 12:49
Copy link

cypress bot commented Dec 27, 2024

klicker-uzh    Run #3846

Run Properties:  status check passed Passed #3846  •  git commit 5ca0d5f8ac: fix(packages/graphql): ensure that live quiz evaluation for free text questions ...
Project klicker-uzh
Branch Review v3
Run status status check passed Passed #3846
Run duration 12m 04s
Commit git commit 5ca0d5f8ac: fix(packages/graphql): ensure that live quiz evaluation for free text questions ...
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 148
View all changes introduced in this branch ↗︎

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