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

Adaptive learning: Add source display to standardized competencies #8638

Merged
merged 10 commits into from
May 24, 2024

Conversation

rstief
Copy link
Contributor

@rstief rstief commented May 20, 2024

Test only on ts3 or somewhere you are an admin!

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

The source of a standardized competency was not visible or editable before.

Description

Adds the option to:

  • View the sources of standardized competencies when importing and managing standardized competencies
  • Change the source of a standardized competency

Testing

Prerequisites:

  • 1 Administrator
  1. Log into Artemis
  2. Go to Server Administration -> Feature Toggles -> Enable Standardized Competencies
  3. Go to Server Administration -> Standardized Competencies
  4. View a standardized competency (not knowledge area) and see that it has a source (that can be edited aswell)
  5. Go to course management -> competencies -> import standardized competencies
  6. See that the sources are displayed here aswell

Testserver States

Note

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






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
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Client

Class/File Line Coverage Confirmation (assert/expect)
admin-import-standardized-competencies.component.ts 97.5%
standardized-competency-edit.component.ts 100%
standardized-competency-management.component.ts 86.66%
course-import-standardized-competencies.component.ts 95.4%
standardized-competency.model.ts 100%
standardized-competency-detail.component.ts 100%
standardized-competency.service.ts 100%

Server

Class/File Line Coverage Confirmation (assert/expect)
StandardizedCompetencyResource.java 100%
SourceDTO.java 100%

Screenshots

image

@rstief rstief requested a review from a team as a code owner May 20, 2024 12:59
Copy link

coderabbitai bot commented May 20, 2024

Walkthrough

The recent updates introduce a new SourceDTO entity and SourceRepository to manage source information related to competencies. Various components and services have been modified to include source handling, such as fetching, displaying, and selecting sources. Additionally, the user interface has been updated to accommodate these changes, including new input bindings and form controls for sources. Corresponding tests have been updated to ensure the correct functionality of these new features.

Changes

File Path Change Summary
src/main/java/.../StandardizedCompetencyResource.java Added SourceDTO entity and SourceRepository. Modified constructor and added getSources() method.
src/main/java/.../dto/standardizedCompetency/SourceDTO.java Defined SourceDTO class with a static method of to create a SourceDTO object from a Source object.
src/test/java/.../StandardizedCompetencyIntegrationTest.java Added SourceDTO import and nested test class GetSources with relevant test methods.
src/main/webapp/app/.../admin-import-standardized-competencies.component.html Added [sourceString] input to jhi-standardized-competency-detail component.
src/main/webapp/app/.../admin-import-standardized-competencies.component.ts Added sourceString property and logic to set it based on the selected competency's source.
src/main/webapp/app/.../standardized-competency-edit.component.html Added a form group for selecting a source.
src/main/webapp/app/.../standardized-competency-edit.component.ts Added Source input and sourceId form control.
src/main/webapp/app/.../standardized-competency-management.component.html Added [sources] input to <jhi-standardized-competency-edit> component.
src/main/webapp/app/.../standardized-competency-management.component.ts Added Source entity and modified initialization logic to fetch knowledge areas and sources concurrently.
src/main/webapp/app/.../course-import-standardized-competencies.component.html Added [sourceString] input to <jhi-standardized-competency-detail> component.
src/main/webapp/app/.../course-import-standardized-competencies.component.ts Added Source entity and logic to fetch and handle sources.
src/main/webapp/app/entities/competency/standardized-competency.model.ts Added sourceToString function to convert a Source object to a string.
src/main/webapp/app/.../standardized-competency-detail.component.html Removed specific IDs from <p> elements and added a new <div> for displaying source string.
src/main/webapp/app/.../standardized-competency-detail.component.ts Added sourceString input property.
src/main/webapp/app/.../standardized-competency.service.ts Added getSources() method to retrieve a list of Source entities.
src/main/webapp/i18n/de/standardizedCompetency.json Added "source": "Quelle" under the "fields" section.
src/main/webapp/i18n/en/standardizedCompetency.json Added "source": "Source" under the "competency" section.
src/test/javascript/spec/.../standardized-competency-detail-stub.component.ts Added sourceString input property.
src/test/javascript/spec/.../standardized-competency-edit-stub.ts Added sources input property.
src/test/javascript/spec/.../standardized-competency-management.spec.ts Added Source entity and getSourcesSpy spy instance.
src/test/javascript/spec/.../admin-import-standardized-competencies.spec.ts Renamed component in test file.
src/test/javascript/spec/.../course-import-standardized-competencies.spec.ts Added Source import and initialization of sources array.
src/test/javascript/spec/.../standardized-competency.service.spec.ts Added Source entity and test case for getSources() method.

Tip

New Features and Improvements

Review Settings

Introduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments.

AST-based Instructions

CodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation.

Community-driven AST-based Rules

We are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information.

New Static Analysis Tools

We are continually expanding our support for static analysis tools. We have added support for biome, hadolint, and ast-grep. Update the settings in your .coderabbit.yaml file or head over to the settings page to enable or disable the tools you want to use.

Tone Settings

Users can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:

  • Mr. T: "You must talk like Mr. T in all your code reviews. I pity the fool who doesn't!"
  • Pirate: "Arr, matey! Ye must talk like a pirate in all yer code reviews. Yarrr!"
  • Snarky: "You must be snarky in all your code reviews. Snark, snark, snark!"

Revamped Settings Page

We have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to .coderabbit.yaml will be reflected in the settings page, and vice versa.

Miscellaneous

  • Turn off free summarization: You can switch off free summarization of PRs opened by users not on a paid plan using the enable_free_tier setting.
  • Knowledge-base scope: You can now set the scope of the knowledge base to either the repository (local) or the organization (global) level using the knowledge_base setting. In addition, you can specify Jira project keys and Linear team keys to limit the knowledge base scope for those integrations.
  • High-level summary placement: You can now customize the location of the high-level summary in the PR description using the high_level_summary_placeholder setting (default @coderabbitai summary).
  • Revamped request changes workflow: You can now configure CodeRabbit to auto-approve or request changes on PRs based on the review feedback using the request_changes_workflow setting.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 05f7f82 and 65df827.
Files selected for processing (1)
  • src/test/java/de/tum/in/www1/artemis/competency/StandardizedCompetencyIntegrationTest.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/test/java/de/tum/in/www1/artemis/competency/StandardizedCompetencyIntegrationTest.java

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels May 20, 2024
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: 1

Out of diff range and nitpick comments (1)
src/main/java/de/tum/in/www1/artemis/web/rest/competency/StandardizedCompetencyResource.java (1)

17-19: Integrated SourceRepository and added a new endpoint getSources() to fetch all sources. Consider using a Data Transfer Object (DTO) instead of directly returning the Source entity to align with best practices of separating the API layer from the data access layer.

Also applies to: 42-49, 99-111

coderabbitai[bot]
coderabbitai bot previously approved these changes May 20, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 20, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 20, 2024
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

Out of diff range and nitpick comments (1)
src/test/javascript/spec/component/standardized-competencies/admin-import-standardized-competencies.spec.ts (1)

19-19: Ensure the test suite description accurately reflects the component's functionality.

Consider updating the description to include details about handling the new sourceString property, as this is a significant part of the component's new functionality.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 20, 2024
dmytropolityka
dmytropolityka previously approved these changes May 23, 2024
Copy link
Contributor

@dmytropolityka dmytropolityka left a comment

Choose a reason for hiding this comment

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

code

Jan-Thurner
Jan-Thurner previously approved these changes May 23, 2024
Copy link
Contributor

@Jan-Thurner Jan-Thurner left a comment

Choose a reason for hiding this comment

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

Code LGTM. Tested on TS3 and works as expected 👍

@MaximilianAnzinger MaximilianAnzinger changed the title Adaptive Learning: Add source display to standardized competencies Adaptive learning: Add source display to standardized competencies May 24, 2024
Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

Maintainer approved

@MaximilianAnzinger MaximilianAnzinger added this to the 7.1.0 milestone May 24, 2024
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 (4)
src/test/javascript/spec/component/standardized-competencies/admin-import-standardized-competencies.spec.ts (1)

Line range hint 53-53: Consider using a more specific type instead of any for event objects to enhance type safety.

- const event: any = {
+ const event: Event = {

Also applies to: 69-69

src/main/webapp/app/admin/standardized-competencies/import/admin-import-standardized-competencies.component.ts (3)

Line range hint 96-96: Use strict equality check (!==) instead of loose equality (!=) to avoid unexpected type coercion.

- if (fileList.length != 1) {
+ if (fileList.length !== 1) {

Line range hint 104-110: The else clause can be omitted for cleaner and more efficient code, as the previous branches already terminate the function with return.

- } else {
-     this.fileReader.readAsText(file);
-     this.fileReader.onload = () => this.setImportDataAndCount();
- }
+ this.fileReader.readAsText(file);
+ this.fileReader.onload = () => this.setImportDataAndCount();

Line range hint 129-129: Avoid using non-null assertions. Consider adding checks or using optional chaining.

- this.adminStandardizedCompetencyService.importStandardizedCompetencyCatalog(this.importData!).subscribe({
+ this.adminStandardizedCompetencyService.importStandardizedCompetencyCatalog(this.importData ?? throw new Error('Import data is not available')).subscribe({

coderabbitai[bot]
coderabbitai bot previously approved these changes May 24, 2024
@rstief
Copy link
Contributor Author

rstief commented May 24, 2024

Discussed with Max - No re-reviews are necessary as the merge conflict was a single import in a test file (as can be seen in this diff)

@krusche krusche merged commit ccf237a into develop May 24, 2024
28 of 32 checks passed
@krusche krusche deleted the feature/adaptive-learning/add-source-display branch May 24, 2024 11:49
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!) component:AdaptiveLearning server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants