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

enhance: improve live quiz list and show participants on completed quizzes #4284

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

sjschlapbach
Copy link
Member

Screenshot 2024-10-02 at 15 38 36

Copy link

aviator-app bot commented Oct 2, 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 Oct 2, 2024

📝 Walkthrough

Walkthrough

This pull request introduces significant updates across several components and files, primarily focusing on enhancing the Session.tsx component. Key changes include the addition of a participant count icon, modifications to the layout and structure of session blocks, and updates to the GraphQL schema to include new fields in queries and mutations. Additionally, localization files for German and English have been updated to support new message keys for displaying counts of elements. Overall, these changes aim to improve the user experience and data handling within the application.

Changes

File Path Change Summary
apps/frontend-manage/src/components/sessions/Session.tsx - Added faUserGroup icon for participant counts.
- Updated heading structure from H3 to H4.
- Revised layout of session blocks with new header and hover effects for question names.
- Updated styling for improved layout and spacing.
packages/graphql/src/graphql/ops/QGetUserSessions.graphql - Added numOfParticipants field to blocks.
- Added questionId and elementId fields to questionData in instances.
packages/graphql/src/public/client.json - Updated hash for GetUserSessions function.
packages/graphql/src/public/server.json - Added multiple new mutations and queries related to sessions and participant management.
- Modified GetUserSessions query to include numOfParticipants.
packages/graphql/src/services/sessions.ts - Added numOfParticipants property to blocks in getUserSessions function.
packages/i18n/messages/de.ts - Added Nelements: '{number} Element(e)' for German localization.
packages/i18n/messages/en.ts - Added Nelements: '{number} element(s)' for English localization.

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

sonarqubecloud bot commented Oct 2, 2024

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

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: 2

🧹 Outside diff range and nitpick comments (6)
packages/graphql/src/graphql/ops/QGetUserSessions.graphql (3)

27-27: LGTM: Addition of questionId field

The new questionId field in the questionData object is a good addition. It provides more detailed information about each question instance.

Consider adding a comment or documentation to clarify the difference between id and questionId in the questionData object, as their purposes might not be immediately clear to other developers.


28-28: LGTM: Addition of elementId field

The new elementId field in the questionData object is a good addition. It provides additional detailed information about each question instance.

Consider adding a comment or documentation to explain what an "element" refers to in this context. This will help other developers understand the purpose and usage of this field.


22-28: Overall improvements to the GetUserSessions query

The additions of numOfParticipants, questionId, and elementId fields enhance the query by providing more detailed information about sessions, blocks, and questions. These changes align well with the PR objectives of improving the live quiz list and showing participants on completed quizzes.

Consider the performance impact of these additional fields, especially numOfParticipants. Ensure that the backend can efficiently calculate and return this information without significantly impacting query response times, particularly for sessions with a large number of blocks or participants.

packages/i18n/messages/en.ts (2)

198-198: New translation added for element count

A new translation key Nelements has been added with the value '{number} element(s)'. This addition is consistent with the existing structure and naming conventions in the file.

Consider using a more specific key name, such as elementCount or numberOfElements, to improve clarity and maintainability. For example:

-      Nelements: '{number} element(s)',
+      elementCount: '{number} element(s)',

Line range hint 1-1: Consider splitting the localization file for better maintainability

The current localization file is quite large and contains translations for various parts of the application. While it's well-organized, its size might make it challenging to maintain in the long run.

Consider splitting this file into smaller, more manageable parts based on the main categories (e.g., 'shared', 'pwa', 'manage', 'control'). This could improve maintainability and make it easier for developers to locate and update specific translations. For example:

// packages/i18n/messages/en/index.ts
import shared from './shared';
import pwa from './pwa';
import manage from './manage';
import control from './control';

export default {
  shared,
  pwa,
  manage,
  control,
};

// packages/i18n/messages/en/shared.ts
export default {
  table: { ... },
  questions: { ... },
  // ...
};

// Similar structure for pwa.ts, manage.ts, and control.ts

This structure would make it easier to manage translations for specific parts of the application and could potentially improve performance by allowing for more granular loading of translations.

packages/graphql/src/ops.ts (1)

3796-3796: Consider optimizing the GetUserSessions query to fetch only necessary fields

The GetUserSessionsDocument query retrieves a large number of fields, including deeply nested data such as blocks and their instances. If not all of this data is required on the client side, consider selecting only the fields that are needed. This can reduce the payload size and improve network performance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e71423a and 547af4b.

📒 Files selected for processing (8)
  • apps/frontend-manage/src/components/sessions/Session.tsx (3 hunks)
  • packages/graphql/src/graphql/ops/QGetUserSessions.graphql (1 hunks)
  • packages/graphql/src/ops.ts (2 hunks)
  • packages/graphql/src/public/client.json (1 hunks)
  • packages/graphql/src/public/server.json (1 hunks)
  • packages/graphql/src/services/sessions.ts (1 hunks)
  • packages/i18n/messages/de.ts (1 hunks)
  • packages/i18n/messages/en.ts (1 hunks)
🔇 Additional comments (8)
packages/graphql/src/graphql/ops/QGetUserSessions.graphql (1)

22-22: LGTM: Addition of numOfParticipants field

The new numOfParticipants field in the blocks object is a good addition. It aligns with the PR objective of showing participants on quizzes and provides valuable information about the number of participants in each block.

packages/graphql/src/public/client.json (1)

150-150: Verify the impact of changes to GetUserSessions function

The hash value for the "GetUserSessions" function has been updated, indicating changes to its implementation or signature. While this change is likely intentional, it's important to ensure that all dependent parts of the system have been updated accordingly.

To assess the impact of this change, please run the following script to identify potential usage of the GetUserSessions function across the codebase:

This script will help identify areas of the codebase that might be affected by the changes to the GetUserSessions function. Please review the results and ensure that all necessary updates have been made to accommodate any changes in the function's behavior or signature.

packages/graphql/src/services/sessions.ts (1)

Line range hint 1565-1592: Overall assessment of changes in getUserSessions

The modifications to the getUserSessions function enhance the data structure by adding a numOfParticipants property to each block. This change provides more detailed information about session blocks, which could be useful for the frontend or for further processing.

While the change is beneficial, there's room for improvement in how numOfParticipants is calculated, as noted in the previous comment. Apart from this, the changes are localized and don't introduce any significant alterations to the overall functionality of the file or the application.

The changes are approved with the suggestion to refine the numOfParticipants calculation as per the previous comment.

packages/graphql/src/public/server.json (1)

150-150: Excellent addition of numOfParticipants field!

The inclusion of the numOfParticipants field in the blocks object of the GetUserSessions query is a valuable enhancement. This change aligns well with the PR objectives of improving the live quiz list and showing participants on completed quizzes. It will allow the frontend to display the number of participants for each block in a session, providing more detailed information and enhancing the user interface.

packages/i18n/messages/en.ts (1)

Line range hint 1-1: Overall approval of the localization file

The localization file is well-structured, consistent in formatting, and the new addition is appropriate. The suggested improvements (more specific key naming and file splitting) are optional enhancements that could be considered for future refactoring.

packages/i18n/messages/de.ts (2)

198-198: LGTM! New translation entry added correctly.

The new entry Nelements: '{number} Element(e)' has been added to the generic section. This addition is correctly formatted and follows the existing pattern in the file.


Line range hint 1-2551: Overall approval: Changes look good!

The new translation entry has been correctly added to the German localization file. It follows the existing format and structure, maintaining consistency with the rest of the file. No issues or inconsistencies were introduced by this change.

packages/graphql/src/ops.ts (1)

3558-3558: Ensure proper handling of potential null values in userSessions

The userSessions field in GetUserSessionsQuery is typed as possibly null or undefined. Please ensure that any code consuming this type correctly handles cases where userSessions is null or undefined to prevent runtime errors.

Copy link

cypress bot commented Oct 2, 2024

klicker-uzh    Run #3083

Run Properties:  status check passed Passed #3083  •  git commit 359e6adb3e ℹ️: Merge 547af4b08aae03ba04c4e07fa0799fcfbb6fffb3 into e71423aea55f3a3027fa373d2c0b...
Project klicker-uzh
Branch Review show-participants-completed-quizzes
Run status status check passed Passed #3083
Run duration 09m 48s
Commit git commit 359e6adb3e ℹ️: Merge 547af4b08aae03ba04c4e07fa0799fcfbb6fffb3 into e71423aea55f3a3027fa373d2c0b...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
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 45
View all changes introduced in this branch ↗︎

@sjschlapbach sjschlapbach merged commit e356d43 into v3 Oct 2, 2024
10 of 14 checks passed
@sjschlapbach sjschlapbach deleted the show-participants-completed-quizzes branch October 2, 2024 14:56
Copy link

cypress bot commented Oct 2, 2024

klicker-uzh    Run #3087

Run Properties:  status check passed Passed #3087  •  git commit e356d437c8: enhance: improve live quiz list and show participants on completed quizzes (#428...
Project klicker-uzh
Branch Review v3
Run status status check passed Passed #3087
Run duration 09m 37s
Commit git commit e356d437c8: enhance: improve live quiz list and show participants on completed quizzes (#428...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
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 45
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