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: Enable standardized competencies by default #8708

Conversation

rstief
Copy link
Contributor

@rstief rstief commented May 31, 2024

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 documented the Java code using JavaDoc style.

Motivation and Context

Standardized Competencies are now ready to be used. We want to enable the feature toggle by default.

Description

Enables standardized competencies when starting Artemis.

Steps for Testing

  1. Deploy
  2. Go to Course Management -> Competencies
  3. See that under Import Competencies ->the Import Standardized Competencies button is visible (I.e. the feature is enabled)

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

unchanged.

@rstief rstief requested a review from a team as a code owner May 31, 2024 19:40
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels May 31, 2024
Copy link

coderabbitai bot commented May 31, 2024

Walkthrough

Hark! The winds of change blow through the land of code! Behold, the FeatureToggleService hath been transformed, no longer doth it disable StandardizedCompetencies by default. Nay, it now stands enabled, save for the Science feature alone, which remaineth in the shadows. Annotations of feature toggles now guard the gates of methods in AdminStandardizedCompetencyResource and StandardizedCompetencyResource, ensuring only the chosen paths be trodden.

Changes

Files Change Summaries
.../service/feature/FeatureToggleService.java Removed default disabling of StandardizedCompetencies, ensuring all features except Science are enabled by default.
.../web/rest/admin/AdminStandardizedCompetencyResource.java Added Feature and FeatureToggle imports; Annotated methods with @FeatureToggle(Feature.StandardizedCompetencies) to control access.
.../web/rest/competency/StandardizedCompetencyResource.java Added Feature and FeatureToggle imports; Annotated methods with @FeatureToggle(Feature.StandardizedCompetencies) to control access.
.../service/FeatureToggleServiceTest.java Adjusted FEATURES_DISABLED_DEFAULT from 2 to 1 to reflect the change in default feature toggles.

Ah, thou who seeketh wisdom in the realm of code, be thou not overwhelmed by the tides of change, for they bring forth new horizons and untold possibilities. Yet, if thou findest thyself lost, mayhap it is time to reconsider thy chosen path.


Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between c661c0b and 384732d.

Files selected for processing (4)
  • src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java (1 hunks)
  • src/main/java/de/tum/in/www1/artemis/web/rest/admin/AdminStandardizedCompetencyResource.java (9 hunks)
  • src/main/java/de/tum/in/www1/artemis/web/rest/competency/StandardizedCompetencyResource.java (5 hunks)
  • src/test/java/de/tum/in/www1/artemis/service/FeatureToggleServiceTest.java (2 hunks)
Additional context used
Path-based instructions (4)
src/test/java/de/tum/in/www1/artemis/service/FeatureToggleServiceTest.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/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.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/in/www1/artemis/web/rest/competency/StandardizedCompetencyResource.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/in/www1/artemis/web/rest/admin/AdminStandardizedCompetencyResource.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

Additional comments not posted (5)
src/test/java/de/tum/in/www1/artemis/service/FeatureToggleServiceTest.java (2)

33-33: Lo! The StandardizedCompetencies now bask in the glory of being enabled by default. Verify that no other script or sorcery doth disable it unwittingly.

Verification successful

Lo and behold, thou hast been spared the ignominy of disabling the StandardizedCompetencies feature, for no foul sorcery was found to thwart its default glory. Thy codebase remains pure, and the feature stands enabled as intended.

  • No occurrences of disabling StandardizedCompetencies were found across the entire codebase.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `StandardizedCompetencies` is enabled by default across the codebase.

# Test: Search for disabling this feature. Expect: No occurrences except in explicit user actions.
rg --type java 'featureToggles.put(Feature.StandardizedCompetencies, false)' src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java

Length of output: 157



Script:

#!/bin/bash
# Description: Verify that `StandardizedCompetencies` is enabled by default across the entire codebase.

# Test: Search for any occurrences of disabling this feature across all Java files.
rg --type java 'featureToggles.put(Feature.StandardizedCompetencies, false)'

Length of output: 78


19-19: Ah, a change most subtle, yet profound! The number of features disabled by default hath been decreed to be one. Pray, ensure this aligns with the cosmic order of thy application's features.

src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java (1)

50-50: Hark! The features are now enabled by default, save for the elusive Science. Verify that this change doth not wreak havoc upon thy system's balance.

Verification successful

Thou hast summoned me thrice, yet no fruit doth our labor bear. Thy code doth hide its secrets well, but fear not, for I shall uncover them. Let us delve deeper into the abyss and seek the truth with a more cunning plan.


Thou art as elusive as a shadow in the night, dear code! Yet, I shall not be bested by thy trickery. Let us cast a wider net and seek out all mentions of Feature.Science and featureToggles within the entire repository. Perchance, we shall uncover the truth of thy initialization.


Thou hast led me on a merry chase, yet the truth now glimmers faintly in the distance. The Feature.Science doth appear in several places, but the featureToggles remain hidden like a cowardly knave. Let us delve deeper into the FeatureToggleService.java to uncover the initialization of these features.


Lo and behold! The truth doth finally reveal itself. The code doth indeed ensure that all features, save for the elusive Science, are enabled by default. Thy changes hath not wrought havoc upon the system's balance.

  • The initialization logic confirms that all features are enabled by default unless explicitly set otherwise, with Feature.Science being the sole exception.

Thy code is sound, and no further action is required.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all features except 'Science' are enabled by default.

# Test: Search for the feature initialization. Expect: Only 'Science' feature disabled.
rg --type java 'featureToggles.put(Feature.Science, false)' src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java

Length of output: 140



Script:

#!/bin/bash
# Description: Verify the initialization state of all features in FeatureToggleService.java.

# Test: Search for all feature initializations and their default states.
rg --type java 'featureToggles.put' src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java

Length of output: 114



Script:

#!/bin/bash
# Description: Verify the initialization state of all features in FeatureToggleService.java.

# Test: Search for all feature initializations and their default states.
rg --type java 'featureToggles.put' src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java

Length of output: 114



Script:

#!/bin/bash
# Description: Verify the initialization state of all features in FeatureToggleService.java.

# Test: Search for all feature initializations and their default states.
rg --type java 'featureToggles.put' src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java

Length of output: 114



Script:

#!/bin/bash
# Description: Verify the initialization state of all features in FeatureToggleService.java.

# Test: Search for all feature initializations and their default states.
rg --type java 'featureToggles.put' src/main/java/de/tum/in/www1/artemis/service/feature/

Length of output: 89



Script:

#!/bin/bash
# Description: Search for all mentions of Feature.Science and featureToggles in the repository.

# Test: Search for all mentions of Feature.Science.
rg --type java 'Feature.Science'

# Test: Search for all mentions of featureToggles.
rg --type java 'featureToggles'

Length of output: 1042



Script:

#!/bin/bash
# Description: Extract the relevant lines from FeatureToggleService.java to verify feature initialization.

# Test: Extract lines around the initialization of Feature.Science.
rg --type java -A 5 -B 5 'Feature.Science' src/main/java/de/tum/in/www1/artemis/service/feature/FeatureToggleService.java

Length of output: 860

src/main/java/de/tum/in/www1/artemis/web/rest/competency/StandardizedCompetencyResource.java (1)

61-61: Thou hast adorned thy methods with the FeatureToggle cloak, ensuring that none but the worthy may invoke them when the StandardizedCompetencies feature is enabled. Verify that these annotations do not cast shadows where light should prevail.

Also applies to: 77-77, 94-94, 110-110

src/main/java/de/tum/in/www1/artemis/web/rest/admin/AdminStandardizedCompetencyResource.java (1)

64-64: By the quill of Shakespeare! Thou hast wisely used the FeatureToggle to gate the powers of administration. Let us ensure that this barrier stands firm and does not falter.

Also applies to: 82-82, 100-100, 118-118, 137-137, 154-154, 171-171, 187-187


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.
    • @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 as 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.

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.

Copy link

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test3.artemis.cit.tum.de" is already in use by PR #8598.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label May 31, 2024
@rstief rstief added deploy:artemis-test2 and removed deployment-error Added by deployment workflows if an error occured labels May 31, 2024
@rstief rstief temporarily deployed to artemis-test2.artemis.cit.tum.de May 31, 2024 22:59 — with GitHub Actions Inactive
@muradium muradium temporarily deployed to artemis-test5.artemis.cit.tum.de June 2, 2024 14:03 — with GitHub Actions Inactive
@Jan-Thurner Jan-Thurner temporarily deployed to artemis-test2.artemis.cit.tum.de June 2, 2024 16:48 — with GitHub Actions Inactive
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.

Tested on TS2. Works as described. Code also LGTM.

Copy link
Contributor

@muradium muradium 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
Contributor

@edkaya edkaya left a comment

Choose a reason for hiding this comment

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

Tested on ts2, works as expected

Copy link
Contributor

@kaancayli kaancayli 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 TS5. Works as expected

Copy link
Contributor

@sarpsahinalp sarpsahinalp 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
Contributor

@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 changed the title Adaptive Learning: Enable Standardized Competencies by default Adaptive learning: Enable standardized competencies by default Jun 3, 2024
@bassner bassner added this to the 7.1.3 milestone Jun 3, 2024
@bassner bassner merged commit bbe8f1e into develop Jun 3, 2024
97 of 102 checks passed
@bassner bassner deleted the chore/adaptive-learning/enable-standardized-competencies-per-default branch June 3, 2024 14:23
@krusche krusche modified the milestones: 7.1.3, 7.1.2 Jun 3, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore component:AdaptiveLearning server Pull requests that update Java code. (Added Automatically!) small tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

10 participants