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

General: Migrate exam scores module to signals, inject and standalone #9921

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

coolchock
Copy link
Contributor

@coolchock coolchock commented Dec 1, 2024

Checklist

General

Client

Description

This pull request migrates exam scores module to use signals, inject and standalone

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Exam with some scores
  1. Log in to Artemis
  2. Navigate to Course Administration -> Select a course -> Exams -> Exam Scores
  3. Verify that graphs and all information on the exam scores page are displayed properly.
  4. Verify that clicking on the bars in the chart within the Exercise Groups & Exercise Statistics section redirects you to an exercise. Please note that the first bar does not redirect, as it represents the exercise group average. The following bars, however, represent individual exercise averages and will redirect accordingly.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

Release Notes

  • New Features

    • Both ExamScoresComponent and ExamScoresAverageScoresGraphComponent are now standalone components, enhancing their modularity and reusability.
    • Enhanced functionalities for displaying exam scores and statistics, including improved error handling and state management.
    • Updated routing configuration for the exam scores feature, simplifying the setup.
  • Bug Fixes

    • Resolved issues in how average scores and course data are accessed, improving reliability in data display.
    • Improved safety in accessing course properties to prevent potential runtime errors.
  • Tests

    • Streamlined test setups for both components, ensuring better input management and component initialization.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Dec 1, 2024
@coolchock coolchock temporarily deployed to artemis-test1.artemis.cit.tum.de December 2, 2024 09:26 — with GitHub Actions Inactive
@coolchock coolchock marked this pull request as ready for review December 2, 2024 11:02
@coolchock coolchock requested a review from a team as a code owner December 2, 2024 11:02
Copy link

coderabbitai bot commented Dec 2, 2024

Walkthrough

The pull request introduces significant modifications to the ExamScoresAverageScoresGraphComponent and ExamScoresComponent in an Angular application. Key changes include the transition of these components to standalone status, allowing independent usage. The dependency injection mechanism has been updated to utilize the inject function, simplifying initialization. Additionally, the way properties like averageScores and course are accessed has shifted from direct property access to method calls. The module structure has also been updated, reflecting these changes in component registration. Test files have been adjusted to align with the new component structure and input handling.

Changes

File Change Summary
src/main/webapp/app/exam/exam-scores/exam-scores-average-scores-graph.component.html Updated access to averageScores from property access this.averageScores.title to method call this.averageScores().title.
src/main/webapp/app/exam/exam-scores/exam-scores-average-scores-graph.component.ts Converted to standalone component, updated imports, removed constructor, and changed @Input properties to use input function for required inputs. Adjusted methods to access properties accordingly.
src/main/webapp/app/exam/exam-scores/exam-scores.component.ts Converted to standalone component, updated imports, refactored constructor to use inject for dependency injection, added new properties for state management, and improved error handling in ngOnInit.
src/main/webapp/app/exam/exam-scores/exam-scores.module.ts Removed ArtemisExamScoresModule, indicating a shift in how components are managed within the application.
src/test/javascript/spec/component/exam/exam-scores/exam-scores-average-scores-graph.component.spec.ts Adjusted imports, streamlined component initialization, and updated input handling in tests.
src/test/javascript/spec/component/exam/exam-scores/exam-scores.component.spec.ts Enhanced testing setup with new imports and providers, removed unnecessary mock components, and simplified the beforeEach block.
src/main/webapp/app/exam/exam-scores/exam-scores.route.ts Modified routing configuration by removing the previous NgModule setup and introducing new route constants.
src/main/webapp/app/exam/manage/exam-management.module.ts Integrated examScoresState into ENTITY_STATES and removed ArtemisExamScoresModule import.

Possibly related PRs

Suggested labels

refactoring, small, maintainer-approved

Suggested reviewers

  • BBesrour
  • florian-glombik
  • JohannesStoehr
  • SimonEntholzer
  • HawKhiem
  • rabeatwork

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b756c0 and d090515.

📒 Files selected for processing (1)
  • src/main/webapp/app/exam/exam-scores/exam-scores.route.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/app/exam/exam-scores/exam-scores.route.ts

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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

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.

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 2, 2024
Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

Tested on TS3. I can't seem to access exams scores. I don't know if I missed any step. Please correct me if I'm wrong (I can't upload videos for some reason. Its been loading for 10 minutes so I upload this screenshot. When I clicked on scores, it was simply loading as shown. I waited for about 5 minutes but no scores were shown)

image

@sawys777 sawys777 temporarily deployed to artemis-test1.artemis.cit.tum.de December 6, 2024 23:23 — with GitHub Actions Inactive
@coolchock coolchock temporarily deployed to artemis-test2.artemis.cit.tum.de January 2, 2025 19:56 — with GitHub Actions Inactive
ole-ve
ole-ve previously approved these changes Jan 2, 2025
Copy link
Contributor

@ole-ve ole-ve left a comment

Choose a reason for hiding this comment

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

tested on TS2, works as expected 👍

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 (1)
src/main/webapp/app/exam/exam-scores/exam-scores.component.html (1)

Line range hint 76-259: Enhance table accessibility.

While the table structure is semantically correct, consider the following improvements for better accessibility:

  1. Add scope="col" to header cells in the statistics table
  2. Consider adding <caption> elements to provide better context for screen readers

Example improvement for the exam statistics table header:

 <thead class="table-dark">
     <tr>
-        <th></th>
+        <th scope="col"></th>
         @if (gradingScaleExists && !isBonus) {
-            <th jhiTranslate="artemisApp.examScores.passedColumn"></th>
+            <th scope="col" jhiTranslate="artemisApp.examScores.passedColumn"></th>
         }
-        <th jhiTranslate="artemisApp.examScores.submittedColumn"></th>
-        <th jhiTranslate="artemisApp.examScores.totalColumn"></th>
+        <th scope="col" jhiTranslate="artemisApp.examScores.submittedColumn"></th>
+        <th scope="col" jhiTranslate="artemisApp.examScores.totalColumn"></th>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a01ef4b and 1b756c0.

📒 Files selected for processing (1)
  • src/main/webapp/app/exam/exam-scores/exam-scores.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/exam/exam-scores/exam-scores.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

🔇 Additional comments (3)
src/main/webapp/app/exam/exam-scores/exam-scores.component.html (3)

38-42: LGTM! Safe navigation operator usage is appropriate.

The use of the safe navigation operator (?.) in the RouterLink expressions is a good defensive programming practice. It prevents runtime errors when the course object is not yet loaded.


Line range hint 1-24: LGTM! Consistent usage of new Angular control flow syntax.

The template correctly uses the new Angular control flow syntax (@if and @for) instead of the older *ngIf and *ngFor directives, following the coding guidelines.


Line range hint 260-600: LGTM! Well-structured data presentation with proper localization.

The template demonstrates good practices in data presentation:

  • Consistent use of number formatting via roundAndPerformLocalConversion
  • Proper internationalization with translation keys
  • Clean conditional rendering for different exam configurations (bonus, grading scale)

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 2, 2025
HawKhiem
HawKhiem previously approved these changes Jan 2, 2025
Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

Reapprove

ole-ve
ole-ve previously approved these changes Jan 2, 2025
Copy link
Contributor

@ole-ve ole-ve left a comment

Choose a reason for hiding this comment

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

re-approve

SimonEntholzer
SimonEntholzer previously approved these changes Jan 2, 2025
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

works on ts2

BBesrour
BBesrour previously approved these changes Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready to merge tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

7 participants