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: Fix bulk creation of competencies #9682

Merged

Conversation

JohannesStoehr
Copy link
Contributor

@JohannesStoehr JohannesStoehr commented Nov 6, 2024

Checklist

General

Server

Client

Motivation and Context

Fix the competency generation with iris

Description

The competency generation with Iris does not set a mastery threshold. This is fixed now.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Course with Iris enabled for competencies
  1. Log in to Artemis
  2. Navigate to the competency management page in the course
  3. Try to create some competencies using Iris
  4. See that it works

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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messaging for competency attribute validation, enhancing clarity for users.
  • New Features

    • Default value for masteryThreshold in CourseCompetency is now set to 100, ensuring consistent initialization for users.
    • Added masteryThreshold property to form data in competency creation and prerequisite handling tests, reflecting updated requirements.

@JohannesStoehr JohannesStoehr added this to the 7.7.0 milestone Nov 6, 2024
@JohannesStoehr JohannesStoehr requested a review from a team as a code owner November 6, 2024 13:13
@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) atlas Pull requests that affect the corresponding module labels Nov 6, 2024
@MaximilianAnzinger MaximilianAnzinger changed the title Adaptive Learning: Fix bulk creation of competencies Adaptive learning: Fix bulk creation of competencies Nov 6, 2024
N0W0RK
N0W0RK previously approved these changes Nov 6, 2024
Copy link
Contributor

@N0W0RK N0W0RK left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

coderabbitai bot commented Nov 6, 2024

Walkthrough

The changes in this pull request involve updates to error handling and messaging in the CompetencyResource.java file, specifically regarding competency attribute validation. The error message identifier was changed from "invalidPrerequisiteAttributes" to two distinct identifiers: "invalidCompetencyTitle" and "invalidCompetencyMasteryThreshold". Additionally, the CourseCompetency class in competency.model.ts now initializes the masteryThreshold property to a default value of 100. Overall, the structure and logic of the classes remain unchanged, with no new functionalities introduced.

Changes

File Path Change Summary
src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java Updated error message identifiers in checkCompetencyAttributes method for clarity regarding competency title and mastery threshold.
src/main/webapp/app/entities/competency.model.ts Initialized masteryThreshold property to a default value of 100 in the CourseCompetency constructor.
src/test/javascript/spec/component/competencies/create-competency.component.spec.ts Added masteryThreshold property set to 100 in formData, removed unused TextUnit import.
src/test/javascript/spec/component/competencies/create-prerequisite.component.spec.ts Added masteryThreshold property in CourseCompetencyFormData, removed unused TextUnit import.

Possibly related PRs

Suggested labels

feature, ready to merge, component:AdaptiveLearning

Suggested reviewers

  • JohannesWt
  • MaximilianAnzinger
  • florian-glombik
  • az108
  • BBesrour
  • sarpsahinalp

Warning

There were issues while running the following tools:

🔧 pmd
src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java

The following rules are missing or misspelled in your ruleset file category/vm/bestpractices.xml: BooleanInstantiation, DontImportJavaLang, DuplicateImports, EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock, EmptyStatementNotInLoop, EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, EmptyWhileStmt, ExcessiveClassLength, ExcessiveMethodLength, ImportFromSamePackage, MissingBreakInSwitch, SimplifyBooleanAssertion. Please check your ruleset configuration.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 574ce06 and 4be9575.

📒 Files selected for processing (1)
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.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>, 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 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: 2

🧹 Outside diff range and nitpick comments (2)
src/main/webapp/app/entities/competency.model.ts (1)

83-83: Consider the architectural impact on competency mastery evaluation.

The mastery threshold value of 1% seems inconsistent with the competency evaluation architecture:

  1. The getMastery function (line 252) calculates mastery as progress * confidence
  2. Progress is tracked as a percentage (0-100)
  3. A 1% threshold would effectively mark almost any progress as mastery

This could impact:

  • Student progress evaluation
  • Learning path progression
  • Course completion criteria

Consider reviewing the competency mastery evaluation requirements and ensure the threshold aligns with the intended learning outcomes.

src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java (1)

339-343: Consider providing more specific error messages.

The current error message is generic and doesn't indicate which specific attribute failed validation (title, mastery threshold, etc.). Consider providing more detailed error messages to help users quickly identify and fix issues.

-            throw new BadRequestAlertException("The attributes of the competency are invalid!", ENTITY_NAME, "invalidCompetencyAttributes");
+            String errorDetail = competency.getTitle() == null || competency.getTitle().trim().isEmpty() 
+                ? "Title cannot be empty" 
+                : "Mastery threshold must be between 1 and 100";
+            throw new BadRequestAlertException(errorDetail, ENTITY_NAME, "invalidCompetencyAttributes");
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fdc2501 and 6fa4b30.

📒 Files selected for processing (2)
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java (1 hunks)
  • src/main/webapp/app/entities/competency.model.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java (1)

Pattern src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

src/main/webapp/app/entities/competency.model.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 (2)
src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java (2)

Line range hint 1-356: Class structure follows best practices and coding guidelines.

The class demonstrates good adherence to coding guidelines with:

  • Proper constructor-based dependency injection
  • Well-defined REST endpoints with appropriate HTTP methods
  • Consistent security annotations
  • Proper logging implementation

341-341: Error message identifier accurately reflects the validation context.

The change from "invalidPrerequisiteAttributes" to "invalidCompetencyAttributes" better represents the actual validation being performed.

Copy link

github-actions bot commented Nov 6, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 6, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 6, 2024
@JohannesStoehr JohannesStoehr removed the deployment-error Added by deployment workflows if an error occured label Nov 6, 2024
JohannesWt
JohannesWt previously approved these changes Nov 6, 2024
Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Code 👍

Copy link

github-actions bot commented Nov 6, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 6, 2024
@JohannesStoehr JohannesStoehr added deploy:artemis-test3 and removed deployment-error Added by deployment workflows if an error occured labels Nov 6, 2024
Copy link

github-actions bot commented Nov 6, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 6, 2024
Copy link

github-actions bot commented Nov 8, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
@florian-glombik florian-glombik added deploy:artemis-test3 and removed deployment-error Added by deployment workflows if an error occured labels Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
@florian-glombik florian-glombik removed the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
@HawKhiem HawKhiem added deploy:artemis-test3 and removed deployment-error Added by deployment workflows if an error occured labels Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

Copy link
Member

@krusche krusche left a comment

Choose a reason for hiding this comment

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

Code looks good 👍

@krusche krusche merged commit 43446ae into develop Nov 10, 2024
17 of 21 checks passed
@krusche krusche deleted the bugfix/adaptive-learning/fix-competency-bulk-creation branch November 10, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
atlas Pull requests that affect the corresponding module bugfix client Pull requests that update TypeScript code. (Added Automatically!) deployment-error Added by deployment workflows if an error occured server Pull requests that update Java code. (Added Automatically!) small tests
Projects
Status: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants