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 competency progress update for exercise and lecture unit operations #8976

Merged
merged 21 commits into from
Jul 14, 2024

Conversation

JohannesStoehr
Copy link
Contributor

@JohannesStoehr JohannesStoehr commented Jul 5, 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

The competency progress was not updated correctly for different exercise and lecture operations. This could lead to wrong information shown to the student as well as wrong suggestions on the learning path.

Description

Each operation that an instructor can do regarding exercises and lecture units should now correctly update the competency progress. These operations include:

  • Creating an exercise/lecture unit and directly link it to a competency
  • Updating an exercise/lecture unit and change the linked competencies
  • Deleting an exercise/lecture unit that is linked to a competency
  • Deleting a lecture that contains lecture units that are linked to competencies
  • Import an exercise and directly link it to a competency
    IMPORTANT: The corresponding updates are done asynchronously, so it might take a short while until the changes are noticeable.

Any operation that changes the student score (e.g. assessment or changing programming test cases) already lead to a reevaluation of competency progresses. But this is only checked every minute and then asynchronously updated, so it might take a while...

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Student with some progress in a competency
  1. Log in to Artemis
  2. Do different operations as an instructor and check that the competency progress increases/decreases for the student accordingly

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

Server

Class/File Line Coverage Confirmation (assert/expect)
AttachmentUnitService.java 89%
ExerciseDeletionService.java 96%
ExerciseImportService.java 97%
FileUploadExerciseImportService.java 100%
LectureService.java 98%
LectureUnitService.java 88%
ModelingExerciseImportService.java 96%
ParticipationService.java 90%
TextExerciseImportService.java 100%
CompetencyProgressService.java 95%
ProgrammingExerciseService.java 87%
QuizExerciseImportService.java 94%
CompetencyResource.java 94%
FileUploadExerciseResource.java 100%
LectureResource.java 90%
ModelingExerciseResource.java 96%
QuizExerciseResource.java 92%
TextExerciseResource.java 96%
AttachmentUnitResource.java 92%
OnlineUnitResource.java 87%
TextUnitResource.java 96%
VideoUnitResource.java 90%
ProgrammingExerciseExportImportResource.java 91%
ProgrammingExerciseResource.java 81%

Summary by CodeRabbit

  • Bug Fixes

    • Improved entity disconnection to maintain database integrity.
  • New Features

    • Enhanced exercise repositories to fetch entities with related competencies.
    • Added methods to retrieve competencies and user scores for various exercises.
    • Added functionality to fetch users within a specific course.
    • Introduced competency progress tracking for updated learning objects.
  • Improvements

    • Refined methods to ensure eager loading of competencies in exercises.
    • Enhanced dependencies and functionality in services to handle competencies.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels Jul 5, 2024
@JohannesStoehr JohannesStoehr marked this pull request as ready for review July 5, 2024 20:14
@JohannesStoehr JohannesStoehr requested a review from a team as a code owner July 5, 2024 20:15
Copy link

coderabbitai bot commented Jul 5, 2024

Walkthrough

The recent updates across various repository and service files in the project primarily focus on enhancing the handling and retrieval of competencies for different exercise types and learning objects. Key modifications include refining methods to avoid clearing competencies, introducing new methods to fetch entities with competencies, and adding dependencies and logic to manage competency progress. These enhancements aim to ensure database integrity, improve data fetching efficiency, and maintain accurate competency tracking.

Changes

File Path Change Summary
.../domain/Exercise.java Updated disconnectRelatedEntities to exclude clearing competencies.
.../repository/AttachmentUnitRepository.java Modified method to include fetching competencies with slides.
.../repository/CourseCompetencyRepository.java Added imports and new methods for retrieving competency IDs related to exercises and lecture units.
.../repository/FileUploadExerciseRepository.java Introduced new methods for fetching FileUploadExercise with competencies.
.../repository/LectureUnitCompletionRepository.java Added a method to retrieve users who completed a lecture unit.
.../repository/LectureUnitRepository.java Removed method for fetching lecture units with competencies.
.../repository/ModelingExerciseRepository.java Added methods for fetching ModelingExercise with competencies.
.../repository/OnlineUnitRepository.java Added methods for fetching OnlineUnit with competencies.
.../repository/ProgrammingExerciseRepository.java Introduced methods to fetch ProgrammingExercise with competencies and auxiliary repositories.
.../repository/QuizExerciseRepository.java Added methods for fetching QuizExercise with competencies and questions.
.../repository/StudentScoreRepository.java Added a method for retrieving users with scores for a specific exercise.
.../repository/TeamScoreRepository.java Added a method for retrieving users with scores for a specific exercise.
.../repository/TextExerciseRepository.java Introduced methods for fetching TextExercise with competencies.
.../repository/UserRepository.java Removed getUserWithAuthorities method and added getUsersInCourse method.
.../repository/VideoUnitRepository.java Added methods for fetching VideoUnit with competencies.
.../service/AttachmentUnitService.java Updated constructor to include CompetencyProgressService and modified updateAttachmentUnit.
.../service/CourseService.java Modified deleteLecturesOfCourse method to change behavior.
.../service/ExerciseDeletionService.java Added dependency on CompetencyProgressService and logic for handling competencies during exercise deletion.
.../service/LectureUnitService.java Added dependency on CompetencyProgressService and updated removeLectureUnit method.
.../service/ParticipantScoreService.java Added method to get users who participated in an exercise.
.../service/competency/CompetencyProgressService.java Refactored methods for updating competency progress and added new methods.
.../service/competency/CompetencyRelationService.java Removed CompetencyRepository from constructor and its associated field.

Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 198445e and 5ad41dd.

Files selected for processing (2)
  • src/main/java/de/tum/in/www1/artemis/repository/CourseCompetencyRepository.java (3 hunks)
  • src/main/java/de/tum/in/www1/artemis/service/ParticipantScoreService.java (1 hunks)
Additional context used
Path-based instructions (2)
src/main/java/de/tum/in/www1/artemis/repository/CourseCompetencyRepository.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/service/ParticipantScoreService.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 (4)
src/main/java/de/tum/in/www1/artemis/repository/CourseCompetencyRepository.java (3)

103-109: LGTM!

The method findAllIdsByExercise correctly fetches competency IDs based on a given exercise.


111-117: LGTM!

The method findAllIdsByLectureUnit correctly fetches competency IDs based on a given lecture unit.


161-173: LGTM!

The method findAllIdsByLearningObject correctly fetches competency IDs based on a given learning object using a switch expression.

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

220-233: LGTM!

The method getAllParticipatedUsersInExercise correctly fetches all users that participated in a given exercise, handling both individual and team exercises.


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

@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

Outside diff range comments (1)
src/main/java/de/tum/in/www1/artemis/repository/TextUnitRepository.java (1)

Line range hint 14-19:
Add null check for robustness.

Even though the Optional return type helps in handling null values, adding a null check with a clear error message can catch potential issues early.

+  default TextUnit findByIdWithCompetenciesElseThrow(long textUnitId) {
+      return getValueElseThrow(findByIdWithCompetencies(textUnitId), textUnitId);
+  }

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 5, 2024
Copy link
Member

@BBesrour BBesrour 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 TS3

The competency isn't updated in this scenario:

  1. As student, mark a lecture unit as completed
  2. As Instructor, create (or import) a new competency and link it to the completed competency.
  3. Student competency not updated.

image

image

image

@pzdr7 pzdr7 temporarily deployed to artemis-test3.artemis.cit.tum.de July 7, 2024 08:04 — with GitHub Actions Inactive
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

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

Outside diff range comments (1)
src/main/java/de/tum/in/www1/artemis/service/learningpath/LearningPathRecommendationService.java (1)

[!TIP]
Codebase Verification

Update method calls to match the new signature

The method getOrderOfLearningObjectsForCompetency has been refactored to remove the User parameter. However, there are still occurrences in the codebase where the method is called with the old signature. These calls need to be updated to match the new method signature.

  • src/main/java/de/tum/in/www1/artemis/web/rest/LearningPathResource.java
    • Line 1: getOrderOfLearningObjectsForCompetency(competencyId, user)
  • src/main/java/de/tum/in/www1/artemis/service/learningpath/LearningPathRecommendationService.java
    • Line 1: getOrderOfLearningObjectsForCompetency(lastCompletedCompetency, user)
    • Line 2: getOrderOfLearningObjectsForCompetency(competency, user)
  • src/main/java/de/tum/in/www1/artemis/service/learningpath/LearningPathNavigationService.java
    • Line 1: getOrderOfLearningObjectsForCompetency(currentCompetency, learningPath.getUser())
    • Line 2: getOrderOfLearningObjectsForCompetency(competencyToSearch, user)
    • Line 3: getOrderOfLearningObjectsForCompetency(nextCompetencyToSearch, user)
    • Line 4: getOrderOfLearningObjectsForCompetency(competency, learningPathUser)

Please update these method calls to remove the User parameter.

Analysis chain

Line range hint 410-419: LGTM! But verify the method usage in the codebase.

The removal of the User parameter simplifies the method signature and improves readability.

However, ensure that all method calls to getOrderOfLearningObjectsForCompetency match the new signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all method calls to `getOrderOfLearningObjectsForCompetency` match the new signature.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type java -A 5 $'getOrderOfLearningObjectsForCompetency'

Length of output: 8544

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 13, 2024
@JohannesStoehr JohannesStoehr modified the milestones: 7.4.2, 7.4.3 Jul 13, 2024
@krusche krusche modified the milestones: 7.4.3, 7.4.2 Jul 14, 2024
@krusche krusche merged commit c7f1bc2 into develop Jul 14, 2024
20 of 25 checks passed
@krusche krusche deleted the bugfix/adaptive-learning/update-progress-on-delete branch July 14, 2024 07:34
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!) maintainer-approved The feature maintainer has approved the PR ready to merge 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.

10 participants