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 learner profile #9673

Merged
merged 35 commits into from
Jan 16, 2025

Conversation

N0W0RK
Copy link
Contributor

@N0W0RK N0W0RK commented Nov 5, 2024

Warning

This PR includes a migration! Do not deploy on testservers

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 principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • 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.

Motivation and Context

Based on #9448

Description

Added LearnerProfile and CourseLearnerProfile. Each user has a LearnerProfile and each user in an active (current semester and not a test course) course with learning paths has automatically a course learner profile.
The CourseLearnerProfile is also created when a user enrolls in a course with learning paths or learning paths get enabled. The profiles are deleted if the user unenrolls or is deleted.

This PR does not add any UI!

LearnerProfileBasic drawio(1)

Steps for Testing

🚨 🚨 Local setup to verify database entries 🚨 🚨
Course with enabled learning paths and some students

  1. Log in to Artemis
  2. Check that the migration works and all existing users have a corresponding entry in the learner profile table
  3. Check that the migration works and all existing users in the course with learning paths have a corresponding entry in the course learner profile table
  4. Create a new user and check that they also get a new learner profile in the data base
  5. Delete the course and check that the corresponding course learner profiles are deleted as well
  6. Delete a user and check that the corresponding learner profile course learner profiles are deleted as well

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

Server

Class/File Line Coverage Confirmation (assert/expect)
LearnerProfileApi.java 85%
CourseLearnerProfile.java 28%
LearnerProfile.java 40%
LearnerProfileRepository.java 100%
LearningPathService.java 90%
CourseLearnerProfileService.java 100%
LearnerProfileService.java 100%
User.java 90%
UserRepository.java 87%
CourseService.java 93%
UserScheduleService.java 91%
UserCreationService.java 91%
UserService.java 89%
CourseResource.java 89%

LearnerProfile.java and CourseLearnerProfile.java currently only represent Datastructures without any logic. Coverage will be higher after subsequent PRs introduce logic and more tests.

Summary by CodeRabbit

Based on the comprehensive summary of changes, here are the updated release notes:

  • New Features

    • Added learner profile functionality for users.
    • Introduced course-specific learner profiles.
    • Enhanced user management with profile creation and deletion.
    • Implemented methods for managing learner profiles via a new API.
  • Improvements

    • Integrated learner profiles with course enrollment.
    • Added support for tracking learning paths and user learning goals.
    • Implemented lazy loading for learner profiles.
  • Technical Enhancements

    • Created new repositories and services for managing learner profiles.
    • Updated user management processes to include profile creation.
    • Expanded test coverage for new profile-related functionality.

These changes introduce a more comprehensive user profile system, allowing for more personalized learning experiences and better tracking of user progress across courses.

@N0W0RK N0W0RK self-assigned this Nov 5, 2024
@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) atlas Pull requests that affect the corresponding module labels Nov 5, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 7, 2024
@github-actions github-actions bot added database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. core Pull requests that affect the corresponding module labels Nov 7, 2024
@JohannesStoehr JohannesStoehr self-assigned this Nov 7, 2024
@github-actions github-actions bot added tests programming Pull requests that affect the corresponding module labels Nov 7, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 11, 2024
@N0W0RK N0W0RK changed the title Add LearnerProfile Adaptive learning: Add LearnerProfile Nov 13, 2024
@N0W0RK N0W0RK marked this pull request as ready for review November 19, 2024 01:05
@N0W0RK N0W0RK requested a review from a team as a code owner November 19, 2024 01:05
@N0W0RK N0W0RK force-pushed the feature/adaptive-learning/learner-profile branch from 0ee393f to 86250b1 Compare January 14, 2025 15:52
@github-actions github-actions bot added client Pull requests that update TypeScript code. (Added Automatically!) documentation config-change Pull requests that change the config in a way that they require a deployment via Ansible. template exercise Pull requests that affect the corresponding module labels Jan 14, 2025
@N0W0RK N0W0RK force-pushed the feature/adaptive-learning/learner-profile branch from 86250b1 to 1780a78 Compare January 14, 2025 15:57
@github-actions github-actions bot removed client Pull requests that update TypeScript code. (Added Automatically!) documentation config-change Pull requests that change the config in a way that they require a deployment via Ansible. template exercise Pull requests that affect the corresponding module labels Jan 14, 2025
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: 3

🧹 Nitpick comments (1)
src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileArchitectureTest.java (1)

28-33: Use more descriptive constant names.

The constant names could be more descriptive to better convey their purpose in the test scenarios.

-    private static final String TEST_PREFIX = "learningpathintegration";
-    private static final int NUMBER_OF_STUDENTS = 1;
-    private static final String STUDENT1_OF_COURSE = TEST_PREFIX + "student1";
+    private static final String LEARNING_PATH_TEST_PREFIX = "learningpathintegration";
+    private static final int INITIAL_STUDENT_COUNT = 1;
+    private static final String ENROLLED_STUDENT_USERNAME = LEARNING_PATH_TEST_PREFIX + "student1";
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 27fdfb5 and b6bcda4.

📒 Files selected for processing (1)
  • src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileArchitectureTest.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileArchitectureTest.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

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: client-style
  • GitHub Check: server-tests
  • GitHub Check: client-tests-selected
  • GitHub Check: server-style
  • GitHub Check: client-tests
  • GitHub Check: Analyse
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Build .war artifact

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

🧹 Nitpick comments (2)
src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.java (2)

14-19: Make test data prefix more specific to the test scenario.

Consider renaming TEST_PREFIX to something more specific like LAZY_LOADING_TEST_PREFIX to better reflect the test scenario.


20-29: Document test scenario and optimize user creation.

The setup creates users that aren't used in the current test cases. Consider:

  1. Adding JavaDoc to document the test scenario.
  2. Creating only the users needed for the current test.
 @BeforeEach
+/**
+ * Sets up the test scenario by creating:
+ * - One student (STUDENT1_OF_COURSE)
+ * - Two additional users not in the course
+ * Creates learner profiles for all users with the test prefix
+ */
 void setupTestScenario() {
     userUtilService.addUsers(TEST_PREFIX, NUMBER_OF_STUDENTS, 1, 1, 1);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b6bcda4 and 461973f.

📒 Files selected for processing (1)
  • src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.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

⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-tests-selected
  • GitHub Check: client-style
  • GitHub Check: client-tests
  • GitHub Check: server-style
  • GitHub Check: server-tests
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Analyse
  • GitHub Check: Build .war artifact
🔇 Additional comments (1)
src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.java (1)

1-12: LGTM! Class structure follows best practices.

The class is well-organized with proper package placement, necessary imports, and follows the integration test naming convention.

@N0W0RK N0W0RK force-pushed the feature/adaptive-learning/learner-profile branch from 461973f to 0ffecab Compare January 14, 2025 23:58
@N0W0RK N0W0RK force-pushed the feature/adaptive-learning/learner-profile branch from 0ffecab to 1f2d1e5 Compare January 15, 2025 00:05
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 15, 2025
@krusche krusche added this to the 7.9.0 milestone Jan 16, 2025
@krusche krusche merged commit 0113946 into develop Jan 16, 2025
24 of 27 checks passed
@krusche krusche deleted the feature/adaptive-learning/learner-profile branch January 16, 2025 15:50
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 core Pull requests that affect the corresponding module database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. maintainer-approved The feature maintainer has approved the PR programming Pull requests that affect the corresponding module ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants