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: Change mastery threshold to input field and validate values #9398

Merged

Conversation

JohannesStoehr
Copy link
Contributor

@JohannesStoehr JohannesStoehr commented Oct 1, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex 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).

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 (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

An input field is easier to manage and to select a specific value instead of an slider.

Description

Replace the slide for the mastery threshold with an input field and validate the resulting value on the server and client.

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Log in to Artemis
  2. Navigate to Course Administration
  3. Create/Edit a competency and set a new mastery threshoid value

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

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Bildschirmfoto 2024-10-01 um 15 00 15

Summary by CodeRabbit

  • New Features

    • Enhanced validation for competency and prerequisite attributes during creation and updates.
    • Updated input type for mastery threshold to enforce a numeric range (1-100) in the competency form.
    • Default mastery threshold of 42 set for newly created competencies and prerequisites.
  • Bug Fixes

    • Improved error messaging for invalid competency and prerequisite submissions.
  • Documentation

    • Clarified validation requirements for competency titles and mastery thresholds in the user interface.

Copy link

coderabbitai bot commented Oct 1, 2024

Walkthrough

The pull request introduces significant refactoring in the CompetencyResource and PrerequisiteResource classes to enhance validation logic for competency and prerequisite attributes. This includes the creation of private methods for attribute validation during creation and updates, ensuring that titles are not null or empty and mastery thresholds are within the range of 1 to 100. Additionally, form controls in the front-end component for competencies have been updated to improve user input validation.

Changes

Files Change Summary
src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java, src/main/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java Refactored validation logic for competency and prerequisite attributes into dedicated private methods. Updated method signatures to include throws URISyntaxException. Replaced BadRequestException with BadRequestAlertException for more specific error handling.
src/main/webapp/app/course/competencies/forms/common-course-competency-form.component.html Changed input type for masteryThreshold from range to number, enforcing a value between 1 and 100 and adding the required attribute.
src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java, src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java, src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/PrerequisiteUtilService.java, src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java Enhanced tests for competency creation and updates to include checks for masteryThreshold. Updated utility services to set a default mastery threshold of 42 for competencies and prerequisites.

Possibly related PRs

Suggested labels

feature, enhancement, ready to merge, maintainer-approved

Suggested reviewers

  • JohannesStoehr
  • MaximilianAnzinger
  • Jan-Thurner
  • pzdr7
  • egekurt123
  • SimonEntholzer

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.

@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 Oct 1, 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: 8

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 4932dc9 and 66282ab.

📒 Files selected for processing (3)
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java (4 hunks)
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java (4 hunks)
  • src/main/webapp/app/course/competencies/forms/common-course-competency-form.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
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/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.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/course/competencies/forms/common-course-competency-form.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/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java (3)

163-163: LGTM! Consistent validation for bulk creation.

The addition of the checkPrerequisitesAttributesForCreation method call for each prerequisite in the list ensures consistent validation for bulk creation, aligning with the single-prerequisite creation method.


302-303: LGTM! Consistent validation for update operation.

The addition of the checkPrerequisitesAttributesForUpdate method call ensures proper validation before updating the prerequisite, maintaining consistency with the creation methods.


Line range hint 141-353: Overall improvements in prerequisite validation. Great job!

The changes in this file significantly enhance the input validation for prerequisites, addressing the PR objectives of validating input values for the mastery threshold. The new validation methods improve code organization, reusability, and consistency across different operations (create, update, bulk create).

Key improvements:

  1. Centralized validation logic in checkPrerequisitesAttributes.
  2. Separate methods for creation and update scenarios.
  3. Consistent application of validation across single and bulk operations.

These changes contribute to better code maintainability and robustness of the prerequisite management functionality.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 1, 2024
raffifasaro
raffifasaro previously approved these changes Oct 1, 2024
Copy link
Contributor

@raffifasaro raffifasaro 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

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 66282ab and 0ab585d.

📒 Files selected for processing (4)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (3 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/PrerequisiteUtilService.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/PrerequisiteUtilService.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

📓 Learnings (2)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java (1)
Learnt from: julian-christl
PR: ls1intum/Artemis#8052
File: src/test/java/de/tum/in/www1/artemis/lecture/CompetencyIntegrationTest.java:310-310
Timestamp: 2024-02-23T00:03:06.365Z
Learning: Modifications to parameters in `competencyProgressUtilService.createCompetencyProgress` for debugging purposes are considered irrelevant to the test outcomes but helpful for clarity during debugging.
src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (1)
Learnt from: julian-christl
PR: ls1intum/Artemis#8052
File: src/test/java/de/tum/in/www1/artemis/lecture/CompetencyIntegrationTest.java:310-310
Timestamp: 2024-02-23T00:03:06.365Z
Learning: Modifications to parameters in `competencyProgressUtilService.createCompetencyProgress` for debugging purposes are considered irrelevant to the test outcomes but helpful for clarity during debugging.
🔇 Additional comments (2)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/PrerequisiteUtilService.java (1)

33-33: Change aligns with PR objectives.

The addition of setting the masteryThreshold aligns well with the PR objective of changing the mastery threshold to an input field. This change in the test utility will help ensure that the new functionality is properly tested.

The implementation looks good and contributes to the overall goal of the PR. Good job on maintaining test data consistency with the new feature!

src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java (1)

Line range hint 1-214: File review: Compliant with coding guidelines

This test utility class adheres to the provided coding guidelines:

  1. Test naming: Methods are descriptively named (e.g., createCompetency, linkLectureUnitToCompetency).
  2. Test size: Methods are small and specific to their tasks.
  3. Fixed data: The class uses fixed data for test scenarios.
  4. Util service factory pattern: The class follows the utility service pattern for creating test data.
  5. Avoid DB access: The class uses repository interfaces for database operations, which can be easily mocked in tests.

The recent change to set a default masteryThreshold maintains consistency with these guidelines while supporting the PR objective of modifying the mastery threshold functionality.

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 66282ab and 0ab585d.

📒 Files selected for processing (4)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (3 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/PrerequisiteUtilService.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/CompetencyUtilService.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

src/test/java/de/tum/cit/aet/artemis/atlas/competency/util/PrerequisiteUtilService.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (1)

Pattern src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

📓 Learnings (1)
src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (1)
Learnt from: julian-christl
PR: ls1intum/Artemis#8052
File: src/test/java/de/tum/in/www1/artemis/lecture/CompetencyIntegrationTest.java:310-310
Timestamp: 2024-02-23T00:03:06.365Z
Learning: Modifications to parameters in `competencyProgressUtilService.createCompetencyProgress` for debugging purposes are considered irrelevant to the test outcomes but helpful for clarity during debugging.

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
Contributor

@pzdr7 pzdr7 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
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

@MaximilianAnzinger MaximilianAnzinger changed the title Adaptive Learning: Change mastery threshold to input field and validate values Adaptive learning: Change mastery threshold to input field and validate values Oct 2, 2024
@az108 az108 temporarily deployed to artemis-test4.artemis.cit.tum.de October 2, 2024 11:52 — with GitHub Actions Inactive
Copy link
Contributor

@az108 az108 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 TS4 and works as expected 👍 Just a small question do we intend to keep the mastery treshhold at 100 percent for new competencies? A slighly lower default value might be better as recommendation for new instructors who create competencies.

image

Copy link
Contributor

@cremertim cremertim left a comment

Choose a reason for hiding this comment

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

Worked on ts 4 for me aswell

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

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 client Pull requests that update TypeScript code. (Added Automatically!) maintainer-approved The feature maintainer has approved the PR ready to merge server Pull requests that update Java code. (Added Automatically!) small tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants