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

Development: Migrate client code for the grading system #10055

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

Conversation

maximiliansoelch
Copy link
Member

@maximiliansoelch maximiliansoelch commented Dec 20, 2024

Checklist

General

Client

Motivation and Context

For the client migration of the complaint components, the following files need to be updated:

-- Filepath Standalone Signals Inject
54 /grading-system/base-grading-system/base-grading-system.component.ts
55 /grading-system/bonus/bonus.component.ts
56 /grading-system/bonus/bonus.service.ts
57 /grading-system/detailed-grading-system/detailed-grading-system.component.ts
58 /grading-system/grading-key-overview/grading-key-overview.component.ts
59 /grading-system/grading-key-overview/grading-key/grading-key-table.component.html
60 /grading-system/grading-key-overview/grading-key/grading-key-table.component.ts
61 /grading-system/grading-system-info-modal/grading-system-info-modal.component.ts
62 /grading-system/grading-system-presentations/grading-system-presentations.component.html
63 /grading-system/grading-system-presentations/grading-system-presentations.component.ts
64 /grading-system/grading-system.component.ts
65 /grading-system/grading-system.service.ts
66 /grading-system/interval-grading-system/interval-grading-system.component.ts

Description

In this PR, we migrate the above-listed components to standalone and perform the inject migration. The signals migration is not part of this PR!

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Students
  1. As an instructor, navigate to Course Management, Assessment, Grading Key
  2. Generate a default grading key and save it
  3. Adapt the grading key and make sure you can save it
  4. Change the presentation mode and save it
  5. As a student, go to statistics and click on grading key to view it

Tip

You can find more info about the grading system and how it works here: https://docs.artemis.cit.tum.de/user/grading.html

Exam Mode Testing

Prerequisites:

  • 1 Instructor
  • 1 Students
  • 1 Exam with a Programming Exercise
  1. Create/import an exam as an instructor
  2. Go to Assessment, Grading key
  3. Generate/Change a grading key and save it
  4. Modify the grading key and verify it gets saved correctly

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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Summary by CodeRabbit

  • New Features

    • Introduced SafeHtmlPipe and GradeStepBoundsPipe for enhanced data handling.
    • Added standalone components and updated existing components to utilize Angular's standalone feature.
  • Bug Fixes

    • Corrected module structure by removing components from the imports array and placing them in the declarations array where appropriate.
  • Documentation

    • Updated component decorators and service injections to reflect modern Angular practices.
  • Tests

    • Adjusted test setups by removing unnecessary declarations and ensuring components are tested correctly without direct instantiation.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Dec 20, 2024
Copy link

coderabbitai bot commented Dec 27, 2024

Walkthrough

This pull request introduces a significant refactoring of various Angular components and modules in the grading system and shared modules. The primary changes include transitioning components to standalone mode, updating dependency injection to use the inject() function, removing constructor-based injection, and modifying module configurations. Key modifications span across multiple files in the grading-system and shared directories, focusing on modernizing the codebase's structure and improving modularity.

Changes

File Path Change Summary
src/main/webapp/app/exam/manage/exam-management.module.ts Added SafeHtmlPipe and GradeStepBoundsPipe to providers, removed BonusComponent from declarations
src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instructions-render.module.ts Added SafeHtmlPipe import
src/main/webapp/app/grading-system/*/*.component.ts Multiple components converted to standalone, updated dependency injection using inject()
src/main/webapp/app/shared/pipes/grade-step-bounds.pipe.ts Added standalone: true to pipe decorator
src/main/webapp/app/shared/pipes/safe-html.pipe.ts Added standalone: true to pipe decorator
src/main/webapp/app/shared/pipes/shared-pipes.module.ts Removed SafeHtmlPipe and GradeStepBoundsPipe from declarations and exports

Possibly related PRs

Suggested Labels

ready to merge, refactoring, small, maintainer-approved

Suggested Reviewers

  • florian-glombik
  • HawKhiem
  • SimonEntholzer
  • BBesrour
  • sachmii
  • Feras797

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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.

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 (4)
src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instructions-render.module.ts (1)

12-12: Ensure consistent ordering and grouping of imports.

While adding SafeHtmlPipe is correct, consider placing standalone imports at the end or in a standalone-specific section of the imports array to keep the module’s structure tidy.

src/main/webapp/app/grading-system/interval-grading-system/interval-grading-system.component.ts (1)

6-14: Check potential overlap in shared modules
While migrating to a standalone component, you are importing both ArtemisSharedModule and ArtemisSharedComponentModule. Consider verifying if both are truly needed. Removing any duplicate modules can simplify the dependency graph and improve maintainability.

Also applies to: 20-31

src/main/webapp/app/exam/manage/exam-management.module.ts (1)

78-78: Defined pipes in providers array.

Registering ArtemisDurationFromSecondsPipe, SafeHtmlPipe, and GradeStepBoundsPipe in the providers array is valid. However, if some or all are purely standalone pipes, you could import them in components on demand for a more modular approach.

src/main/webapp/app/grading-system/bonus/bonus.service.ts (1)

17-17: Maintain consistent property ordering.

The resourceUrl is now placed below the newly injected services. Although valid, consider ordering properties for clarity, such as placing constants and configuration properties near the class start, followed by service dependencies.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d6a1b81 and b02256d.

📒 Files selected for processing (26)
  • src/main/webapp/app/exam/manage/exam-management.module.ts (2 hunks)
  • src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instructions-render.module.ts (1 hunks)
  • src/main/webapp/app/grading-system/base-grading-system/base-grading-system.component.ts (2 hunks)
  • src/main/webapp/app/grading-system/bonus/bonus.component.ts (3 hunks)
  • src/main/webapp/app/grading-system/bonus/bonus.service.ts (2 hunks)
  • src/main/webapp/app/grading-system/detailed-grading-system/detailed-grading-system.component.ts (1 hunks)
  • src/main/webapp/app/grading-system/grading-key-overview/grading-key-overview.component.ts (1 hunks)
  • src/main/webapp/app/grading-system/grading-key-overview/grading-key-overview.module.ts (1 hunks)
  • src/main/webapp/app/grading-system/grading-key-overview/grading-key/grading-key-table.component.ts (2 hunks)
  • src/main/webapp/app/grading-system/grading-system-info-modal/grading-system-info-modal.component.ts (1 hunks)
  • src/main/webapp/app/grading-system/grading-system-presentations/grading-system-presentations.component.ts (2 hunks)
  • src/main/webapp/app/grading-system/grading-system.component.ts (1 hunks)
  • src/main/webapp/app/grading-system/grading-system.module.ts (1 hunks)
  • src/main/webapp/app/grading-system/grading-system.service.ts (2 hunks)
  • src/main/webapp/app/grading-system/interval-grading-system/interval-grading-system.component.ts (1 hunks)
  • src/main/webapp/app/shared/pipes/grade-step-bounds.pipe.ts (1 hunks)
  • src/main/webapp/app/shared/pipes/safe-html.pipe.ts (1 hunks)
  • src/main/webapp/app/shared/pipes/shared-pipes.module.ts (0 hunks)
  • src/test/javascript/spec/component/bonus/bonus.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/exam/participate/exam-navigation-sidebar.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/grading-system/detailed-grading-system.component.spec.ts (0 hunks)
  • src/test/javascript/spec/component/grading-system/grading-key-overview.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/grading-system/grading-key-table.component.spec.ts (2 hunks)
  • src/test/javascript/spec/component/grading-system/grading-system-presentations.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/grading-system/grading-system.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/grading-system/interval-grading-system.component.spec.ts (0 hunks)
💤 Files with no reviewable changes (3)
  • src/main/webapp/app/shared/pipes/shared-pipes.module.ts
  • src/test/javascript/spec/component/grading-system/interval-grading-system.component.spec.ts
  • src/test/javascript/spec/component/grading-system/detailed-grading-system.component.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • src/test/javascript/spec/component/grading-system/grading-system.component.spec.ts
🧰 Additional context used
📓 Path-based instructions (22)
src/test/javascript/spec/component/bonus/bonus.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/main/webapp/app/exam/manage/exam-management.module.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/test/javascript/spec/component/exam/participate/exam-navigation-sidebar.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/test/javascript/spec/component/grading-system/grading-system-presentations.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/test/javascript/spec/component/grading-system/grading-key-table.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/main/webapp/app/shared/pipes/safe-html.pipe.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instructions-render.module.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-system.service.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/test/javascript/spec/component/grading-system/grading-key-overview.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/main/webapp/app/grading-system/grading-system.module.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/detailed-grading-system/detailed-grading-system.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-system-info-modal/grading-system-info-modal.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/shared/pipes/grade-step-bounds.pipe.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/bonus/bonus.service.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-key-overview/grading-key-overview.module.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/interval-grading-system/interval-grading-system.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-key-overview/grading-key-overview.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/bonus/bonus.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-system-presentations/grading-system-presentations.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-key-overview/grading-key/grading-key-table.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/grading-system.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/grading-system/base-grading-system/base-grading-system.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

🔇 Additional comments (38)
src/main/webapp/app/grading-system/detailed-grading-system/detailed-grading-system.component.ts (2)

4-9: Verify the necessity of newly added imports.

Great job adding the required imports for standalone usage (such as TranslateDirective, ArtemisSharedComponentModule, FormsModule, etc.). However, please confirm that each import is actually used in the template and that redundant imports aren't introduced. If ArtemisSharedModule re-exports everything you need from ArtemisSharedComponentModule, consider removing duplicates to keep imports minimal and consistent.


15-16: Validate standalone component configuration.

Marking the component as standalone is a welcome modernization. Double-check that all required common Angular features (e.g., directives, pipes from CommonModule) are provided—either by the included shared modules or directly—especially if you use built-in directives (*ngIf, *ngFor, etc.).

src/main/webapp/app/grading-system/grading-system.module.ts (1)

14-24: Confirm that all imported components are standalone.
Switching these components from declarations to imports is valid if they're declared as standalone components with standalone: true. Otherwise, it may cause unexpected runtime errors where Angular cannot locate the component definitions. Ensure each component in this list is indeed declared as a standalone component.

src/main/webapp/app/grading-system/grading-key-overview/grading-key/grading-key-table.component.ts (3)

14-18: Additional imports for standalone usage
Providing the necessary directives, pipes, and modules in the imports array ensures seamless usage within a standalone component. Good job keeping them consistent with single quotes.


24-25: Marking the component as standalone
Enabling standalone: true and specifying all required imports here is correct for Angular 14+ standalone components. This modernizes your component configuration.


28-32: Refactor from constructor injection to inject()
Using the inject() API is a clean approach if you're aiming for reduced boilerplate compared to traditional constructor injection. Make sure your tests are updated accordingly.

src/main/webapp/app/shared/pipes/safe-html.pipe.ts (1)

4-4: Marking the pipe as standalone
Declaring standalone: true allows you to import and use this pipe anywhere without needing to declare it in a module. This looks good.

src/main/webapp/app/grading-system/grading-key-overview/grading-key-overview.module.ts (1)

8-8: Importing standalone components directly
Listing GradingKeyOverviewComponent and GradingKeyTableComponent under imports is valid only if they each have standalone: true. Ensure this aligns with your project’s Angular version and architecture plans.

src/main/webapp/app/grading-system/grading-system-info-modal/grading-system-info-modal.component.ts (3)

1-5: Imports for standalone component
These imports allow your standalone component to leverage translation and icon functionalities without a traditional module declaration.


10-11: Defining a standalone component
Using standalone: true with an imports array follows Angular’s recommended configuration for standalone components and keeps the setup more self-contained.


14-14: Using the inject() API
Replacing constructor-based injection with inject(NgbModal) is consistent with the new Angular practices. Make sure related tests handle this pattern correctly.

src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instructions-render.module.ts (1)

9-9: Good addition of the SafeHtmlPipe import.

Bringing in standalone pipes via direct imports is consistent with Angular’s recommended approach. This step effectively ensures the pipe is available within this module.

src/main/webapp/app/shared/pipes/grade-step-bounds.pipe.ts (1)

9-9: Standalone pipe usage is aligned with Angular’s best practices.

Declaring this pipe as standalone provides a clean way to use it without module scoping.

src/main/webapp/app/grading-system/grading-key-overview/grading-key-overview.component.ts (4)

1-1: Switched from constructor injection to the inject() function.

This aligns well with the Angular 14+ recommended dependency injection approach.


8-11: Import statements match the coding guidelines.

Using single quotes and grouping external imports together is consistent with the Angular style guide.


17-18: Transition to a standalone component is appropriate.

Marking the component as standalone and providing dependent imports here simplifies the module structure and eliminates the need for the traditional NgModule-based declarations.


21-24: Utilizing inject() for route, navigation, and theme services.

This approach is concise and future-proof, aligning the code with modern Angular patterns.

src/main/webapp/app/grading-system/grading-system.component.ts (3)

1-14: Imports array efficiently organizes dependencies.

These additions adhere to the Angular style guide, facilitate code reuse, and support lazy loading.


20-33: Standalone declaration streamlines component configuration.

Specifying standalone: true and using the imports array in the component decorator reduces overhead and clarifies the component’s dependencies.


36-37: Switched to inject() for inserting ActivatedRoute.

This new pattern eliminates boilerplate constructors while preserving readability and maintainability.

src/test/javascript/spec/component/grading-system/grading-key-overview.component.spec.ts (1)

41-41: Smooth migration to standalone testing approach
Using the imports array to directly import the standalone component and its mocked dependencies is aligned with Angular's recommended practices. This setup looks good.

src/test/javascript/spec/component/grading-system/grading-system-presentations.component.spec.ts (1)

46-46: Confirm removal of ModePickerComponent mock
Since the ModePickerComponent mock is removed, verify whether it's genuinely no longer needed in these tests or if coverage is affected.

src/main/webapp/app/grading-system/grading-system-presentations/grading-system-presentations.component.ts (1)

4-7: Standalone component adoption
Migrating this component to standalone mode and updating its imports array is consistent with Angular style guidelines. No issues found in this implementation.

Also applies to: 29-30

src/test/javascript/spec/component/grading-system/grading-key-table.component.spec.ts (2)

4-4: Good use of ng-mocks for mocking dependencies.

These imports simplify testing by mocking directives, pipes, and components.


73-73: Proper usage of component-based test imports.

By importing the standalone GradingKeyTableComponent, you align with Angular's recommended approach for testing standalone components. This reduces the need for extensive module declarations.

src/main/webapp/app/exam/manage/exam-management.module.ts (2)

71-72: Clear import statements for standalone pipes.

Importing both SafeHtmlPipe and GradeStepBoundsPipe prior to providing them ensures their availability throughout the module without adding them to declarations. This is a clean approach consistent with Angular’s standalone pipes.


114-116: Importing standalone pipes and a component into the module.

Lines 114-116 add SafeHtmlPipe, GradeStepBoundsPipe, and BonusComponent to the module’s imports array. This is aligned with the standalone approach, ensuring these features can be used throughout the module without listing them in declarations.

src/test/javascript/spec/component/exam/participate/exam-navigation-sidebar.component.spec.ts (1)

39-39: Removed ExamNavigationSidebarComponent from declarations.

Adopting child component mocks (ExamTimerComponent, ExamLiveEventsButtonComponent, and SearchFilterComponent) simplifies testing and focuses on verifying the specialized functionalities. However, ensure integration tests exist elsewhere to confirm that the ExamNavigationSidebarComponent itself is correctly instantiated and functions end-to-end.

src/main/webapp/app/grading-system/bonus/bonus.service.ts (2)

1-1: Usage of the inject function.

Importing inject from @angular/core indicates a transition to the newer injection mechanism. Ensure that the rest of the application remains consistent, preventing hybrid usage of constructor-based injection and inject.


14-15: Injected services as class fields.

Declaring private http and private gradingSystemService with inject(...) is a concise alternative to a constructor. Verify that testing frameworks and tests remain functional, as some older test setups may rely on constructor-based injection.

src/main/webapp/app/grading-system/bonus/bonus.component.ts (4)

1-1: Use of inject aligns with modern Angular standards.
Ensures constructor-free, streamlined dependency injection.


15-19: Imports for standalone component modules and pipes look correct.
These imports appear consistent with Angular style guidelines for standalone components.


35-36: Declaration as a standalone component with an imports array is appropriate.
This setup correctly decouples the component from module-based declarations.


39-44: Migration to inject() for service dependencies is successful.
This approach removes the need for a constructor and keeps the code concise, aligning with Angular best practices.

src/main/webapp/app/grading-system/grading-system.service.ts (1)

1-1: Refactor to using inject() in the service.
Adopting inject(HttpClient) is consistent with the new DI pattern. The public resourceUrl remains accessible as needed.

Also applies to: 16-18

src/test/javascript/spec/component/bonus/bonus.component.spec.ts (1)

19-19: Import of FormsModule and ReactiveFormsModule is valid.
This ensures that the necessary form features are available for the BonusComponent tests.

src/main/webapp/app/grading-system/base-grading-system/base-grading-system.component.ts (2)

1-1: Use of inject from @angular/core supports constructor-free DI.
The import matches Angular style guidelines.


42-47: Switch to inject() for service injection is clean and consistent.
Replaces constructor injection, simplifying the component and maintaining best practices for maintainability.

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 for review tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

1 participant