-
Notifications
You must be signed in to change notification settings - Fork 297
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
Development
: Remove unused code related to ngx graph
#9628
Conversation
WalkthroughThe changes in this pull request involve the removal of various components, services, and tests related to the learning path functionality in an Angular application. Key modifications include the deletion of the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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 and nitpick comments (4)
jest.config.js (1)
104-108
: Consider addressing the TODO comment in a future PR.
There's a TODO comment indicating these coverage thresholds should increase to at least 90% in the future. Given that this PR removes well-tested code (as mentioned in the PR description), it might be worth creating a tracking issue to gradually improve these metrics.
Would you like me to create a GitHub issue to track the coverage improvements?
src/main/webapp/app/overview/courses-routing.module.ts (1)
192-194
: Remove commented out code and approve architectural change.
The switch from loadChildren
(module loading) to loadComponent
(standalone component loading) is a good architectural decision that aligns with modern Angular practices and helps reduce bundle size. However, the commented-out code should be removed as it's no longer needed.
Apply this diff to clean up the code:
loadComponent: () =>
import('app/course/learning-paths/pages/learning-path-student-page/learning-path-student-page.component').then((c) => c.LearningPathStudentPageComponent),
- // loadChildren: () => import('app/course/learning-paths/learning-paths.module').then((m) => m.ArtemisLearningPathsModule),
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java (2)
Line range hint 48-56
: Update class documentation to remove ngx graph reference
The class-level documentation still mentions "retrieval of ngx graph representations" which is no longer a valid feature after the removal of the ngx graph functionality.
Apply this diff to update the documentation:
* This includes
* <ul>
* <li>the generation of learning paths in courses,</li>
* <li>performing pageable searches for learning paths,</li>
- * <li>performing health status checks,</li>
- * <li>and retrieval of ngx graph representations.</li>
+ * <li>and performing health status checks.</li>
* </ul>
Line range hint 419-484
: Consider optimizing database queries in findWithCompetenciesAndReleasedLearningObjectsAndCompletedUsersById
The method performs multiple separate database queries and in-memory operations. Consider optimizing by:
- Using a single JOIN query to fetch competency progresses, lecture unit completions, and student participations
- Implementing batch fetching using @batchsize annotation
- Adding appropriate database indexes for frequently queried columns
This would reduce the number of database roundtrips and improve performance, especially with large datasets.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (65)
- build.gradle (1 hunks)
- jest.config.js (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/atlas/dto/NgxLearningPathDTO.java (0 hunks)
- src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathNgxService.java (0 hunks)
- src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/atlas/web/LearningPathResource.java (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.component.scss (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.module.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-legend.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-legend.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-node.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-node.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path.component.scss (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/competency-node-details.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/competency-node-details.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/exercise-node-details.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/exercise-node-details.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/lecture-unit-node-details.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/lecture-unit-node-details.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-health-status-warning.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-health-status-warning.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-management.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-management.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-management.module.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path-paging.service.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-path.service.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/learning-paths.module.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/learning-path-container.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/learning-path-container.component.scss (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/learning-path-container.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/learning-path-storage.service.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.component.scss (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.module.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-modal.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-modal.component.scss (0 hunks)
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-modal.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-nav.component.html (0 hunks)
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-nav.component.ts (0 hunks)
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress.module.ts (0 hunks)
- src/main/webapp/app/course/manage/course-management.module.ts (0 hunks)
- src/main/webapp/app/overview/courses-routing.module.ts (1 hunks)
- src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java (0 hunks)
- src/test/java/de/tum/cit/aet/artemis/atlas/service/LearningPathServiceTest.java (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/learning-path-graph-node.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/learning-path-graph.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/learning-path-legend.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/learning-path.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/node-details/competency-node-details.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/node-details/exercise-node-details.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/graph/node-details/lecture-unit-node-details.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/management/learning-path-health-status-warning.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/management/learning-path-management.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/management/learning-path-progress-modal.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/management/learning-path-progress-nav.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/participate/learning-path-container.component.spec.ts (0 hunks)
- src/test/javascript/spec/component/learning-paths/participate/learning-path-lecture-unit-view.component.spec.ts (0 hunks)
- src/test/javascript/spec/service/learning-path-paging.service.spec.ts (0 hunks)
- src/test/javascript/spec/service/learning-path-storage.service.spec.ts (0 hunks)
- src/test/javascript/spec/service/learning-path/learning-path.service.spec.ts (0 hunks)
💤 Files with no reviewable changes (61)
- src/main/java/de/tum/cit/aet/artemis/atlas/dto/NgxLearningPathDTO.java
- src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathNgxService.java
- src/main/java/de/tum/cit/aet/artemis/atlas/web/LearningPathResource.java
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.component.scss
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-graph.module.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-legend.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-legend.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-node.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path-node.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path.component.scss
- src/main/webapp/app/course/learning-paths/learning-path-graph/learning-path.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/competency-node-details.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/competency-node-details.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/exercise-node-details.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/exercise-node-details.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/lecture-unit-node-details.component.html
- src/main/webapp/app/course/learning-paths/learning-path-graph/node-details/lecture-unit-node-details.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-health-status-warning.component.html
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-health-status-warning.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-management.component.html
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-management.component.ts
- src/main/webapp/app/course/learning-paths/learning-path-management/learning-path-management.module.ts
- src/main/webapp/app/course/learning-paths/learning-path-paging.service.ts
- src/main/webapp/app/course/learning-paths/learning-path.service.ts
- src/main/webapp/app/course/learning-paths/learning-paths.module.ts
- src/main/webapp/app/course/learning-paths/participate/learning-path-container.component.html
- src/main/webapp/app/course/learning-paths/participate/learning-path-container.component.scss
- src/main/webapp/app/course/learning-paths/participate/learning-path-container.component.ts
- src/main/webapp/app/course/learning-paths/participate/learning-path-storage.service.ts
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.component.html
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.component.scss
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.component.ts
- src/main/webapp/app/course/learning-paths/participate/lecture-unit/learning-path-lecture-unit-view.module.ts
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-modal.component.html
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-modal.component.scss
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-modal.component.ts
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-nav.component.html
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress-nav.component.ts
- src/main/webapp/app/course/learning-paths/progress-modal/learning-path-progress.module.ts
- src/main/webapp/app/course/manage/course-management.module.ts
- src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java
- src/test/java/de/tum/cit/aet/artemis/atlas/service/LearningPathServiceTest.java
- src/test/javascript/spec/component/learning-paths/graph/learning-path-graph-node.component.spec.ts
- src/test/javascript/spec/component/learning-paths/graph/learning-path-graph.component.spec.ts
- src/test/javascript/spec/component/learning-paths/graph/learning-path-legend.component.spec.ts
- src/test/javascript/spec/component/learning-paths/graph/learning-path.component.spec.ts
- src/test/javascript/spec/component/learning-paths/graph/node-details/competency-node-details.component.spec.ts
- src/test/javascript/spec/component/learning-paths/graph/node-details/exercise-node-details.component.spec.ts
- src/test/javascript/spec/component/learning-paths/graph/node-details/lecture-unit-node-details.component.spec.ts
- src/test/javascript/spec/component/learning-paths/management/learning-path-health-status-warning.component.spec.ts
- src/test/javascript/spec/component/learning-paths/management/learning-path-management.component.spec.ts
- src/test/javascript/spec/component/learning-paths/management/learning-path-progress-modal.component.spec.ts
- src/test/javascript/spec/component/learning-paths/management/learning-path-progress-nav.component.spec.ts
- src/test/javascript/spec/component/learning-paths/participate/learning-path-container.component.spec.ts
- src/test/javascript/spec/component/learning-paths/participate/learning-path-lecture-unit-view.component.spec.ts
- src/test/javascript/spec/service/learning-path-paging.service.spec.ts
- src/test/javascript/spec/service/learning-path-storage.service.spec.ts
- src/test/javascript/spec/service/learning-path/learning-path.service.spec.ts
🧰 Additional context used
📓 Path-based instructions (2)
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.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/overview/courses-routing.module.ts (1)
🔇 Additional comments (4)
jest.config.js (1)
105-108
: LGTM! Coverage threshold adjustments are reasonable.
The minor decreases in coverage thresholds (≤0.08%) align well with the PR's objective of removing the unused ngx graph components. The changes are minimal and proportional to the removed code.
src/main/webapp/app/overview/courses-routing.module.ts (1)
192-194
: Verify module-level dependencies.
Since we're transitioning from a module-based to a component-based approach, please verify that any module-level providers (services, guards, etc.) previously provided by ArtemisLearningPathsModule
are now properly handled.
Let's check for any module-level providers that might need migration:
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java (1)
94-95
: LGTM: Constructor changes align with ngx graph removal
The removal of the NgxService dependency from the constructor is consistent with the PR's objective of removing unused ngx graph functionality.
build.gradle (1)
180-180
: LGTM! Verify the coverage threshold adjustment.
The decrease in coverage threshold from 0.894 to 0.892 (0.2%) is reasonable given the removal of well-tested ngx graph components.
Let's verify the current coverage metrics to ensure the new threshold is appropriate:
✅ Verification successful
Coverage threshold adjustment is appropriate
The code context shows:
- A TODO comment indicating a future goal to increase coverage above 0.92
- The current adjustment to 0.892 is a temporary measure
- The change is part of a well-configured JaCoCo setup with proper tooling and reporting
The threshold decrease is minimal and justified as an intermediate step, with clear documentation of plans to increase it in the future.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the current test coverage to validate the threshold adjustment
# Run tests and generate coverage report
./gradlew test jacocoTestReport
# Extract the current instruction coverage from the XML report
rg -A 1 'counter type="INSTRUCTION"' build/reports/jacoco/test/jacocoTestReport.xml
Length of output: 391
Script:
#!/bin/bash
# Let's try a different approach to analyze the coverage threshold context
# First, check if there are any other coverage thresholds in the build file
rg -B2 -A2 "minimum = 0\.89" build.gradle
# Also look for any coverage-related configuration or tasks
rg -B2 -A2 "jacoco" build.gradle
# Check for any test-related configuration
rg -B2 -A2 "test[[:space:]]*{" build.gradle
Length of output: 1817
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean 👍
d38aab5
There was a problem hiding this 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 and nitpick comments (4)
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java (4)
Line range hint
52-59
: Update Documentation to Reflect Removal of Ngx Graph RepresentationsThe class-level Javadoc still mentions the retrieval of Ngx graph representations, which is no longer applicable after removing the Ngx-related methods and services.
Please update the documentation to remove references to Ngx graph representations. Here's the suggested change:
/** * Service Implementation for managing Learning Paths. * <p> * This includes * <ul> * <li>the generation of learning paths in courses,</li> * <li>performing pageable searches for learning paths,</li> * <li>performing health status checks,</li> - * <li>and retrieval of ngx graph representations.</li> * </ul> */
Line range hint
162-164
: Consider Optimizing Progress Calculation LogicIn the
updateLearningPathProgress
method, the calculation of progress could be optimized for clarity and efficiency.Here's a suggested refactor:
- Use
learningPath.getCompetencies().size()
only once.- Avoid setting progress to
0
explicitly when there are no competencies, as the division handles this case.private void updateLearningPathProgress(@NotNull LearningPath learningPath) { final var userId = learningPath.getUser().getId(); final var competencyIds = learningPath.getCompetencies().stream().map(CourseCompetency::getId).collect(Collectors.toSet()); final var competencyProgresses = competencyProgressRepository.findAllByCompetencyIdsAndUserId(competencyIds, userId); - final float completed = competencyProgresses.stream().filter(CompetencyProgressService::isMastered).count(); - final var numberOfCompetencies = learningPath.getCompetencies().size(); - if (numberOfCompetencies == 0) { - learningPath.setProgress(0); - } - else { - learningPath.setProgress(Math.round(completed * 100 / numberOfCompetencies)); - } + final int completed = (int) competencyProgresses.stream().filter(CompetencyProgressService::isMastered).count(); + final int totalCompetencies = learningPath.getCompetencies().size(); + final int progress = totalCompetencies == 0 ? 0 : Math.round((float) completed * 100 / totalCompetencies); + learningPath.setProgress(progress); learningPathRepository.save(learningPath); log.debug("Updated LearningPath (id={}) for user (id={})", learningPath.getId(), userId); }This refactor improves readability by simplifying the logic.
Line range hint
52-59
: Adhere to the Single Responsibility Principle in DocumentationThe documentation lists multiple responsibilities, which might indicate that the class is handling more than one responsibility, potentially violating the single responsibility principle.
Consider reviewing the class's responsibilities and refactoring if necessary to ensure that it adheres to best practices.
Line range hint
52-59
: Remove Duplicate or Unnecessary ImportsReview the import statements and remove any unused or duplicate imports to clean up the code:
-import de.tum.cit.aet.artemis.atlas.dto.LearningPathNgxDTO;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java
(1 hunks)src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java
(0 hunks)
💤 Files with no reviewable changes (1)
- src/test/java/de/tum/cit/aet/artemis/atlas/learningpath/LearningPathIntegrationTest.java
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.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 (3)
src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java (3)
Line range hint 259-261
: Ensure Proper Null Handling for User in Learning Path
In the findWithCompetenciesAndReleasedLearningObjectsAndCompletedUsersById
method, when checking if learningPath.getUser()
is null
, consider handling potential NullPointerException
and ensure that the application logic accounts for this scenario appropriately.
Please verify that learningPath.getUser()
cannot be null
at this point, or add necessary null checks to prevent runtime exceptions.
95-96
: Inject Dependencies via Constructor for Better Testability
The current constructor is injecting several repositories and services. Ensure that all dependencies are essential and consider using constructor injection for better testability and adherence to the dependency inversion principle.
[best_practice]
If any of these repositories are optional, consider injecting them via setters or using optional dependencies.
95-96
: Verify Dependency Usage in Constructor Parameters
After removing the LearningPathNgxService
, ensure that all remaining injected dependencies in the constructor are still necessary and used within the class.
Run the following script to check for unused constructor parameters:
This script will list any constructor parameters that appear to be unused or used less than twice (once in the constructor and once elsewhere). Please review and remove any unnecessary dependencies to adhere to the single responsibility principle and improve maintainability.
✅ Verification successful
All Constructor Dependencies Are Actively Used
Based on the analysis, all constructor parameters are properly utilized within the class:
CompetencyRelationRepository
: Used for querying relations and counts (6 occurrences)LectureUnitCompletionRepository
: Used for finding lecture unit completions (4 occurrences)StudentParticipationRepository
: Used for finding student participations (4 occurrences)CourseCompetencyRepository
: Used for finding course competencies (4 occurrences)
Each dependency is properly initialized in the constructor and used in meaningful operations throughout the class.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify if all constructor parameters are used in the class methods.
# Extract constructor parameter names
params=$(rg 'public LearningPathService\((.*?)\)' -or '$1' -r | sed 's/, /\n/g' | awk '{print $2}')
# Check usage of each parameter in the class file
for param in $params; do
usage_count=$(rg -c "\b$param\b" src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java)
if [[ $usage_count -le 2 ]]; then
echo "Parameter '$param' might be unused or underutilized."
fi
done
Length of output: 542
Script:
#!/bin/bash
# Let's fix the command and check for constructor parameters and their usage
# First, let's get the full content of the constructor and class usage
echo "=== Constructor and Parameter Usage Analysis ==="
rg -A 2 "public LearningPathService\(" src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java
echo -e "\n=== Usage of CompetencyRelationRepository ==="
rg "competencyRelationRepository" src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java
echo -e "\n=== Usage of LectureUnitCompletionRepository ==="
rg "lectureUnitCompletionRepository" src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java
echo -e "\n=== Usage of StudentParticipationRepository ==="
rg "studentParticipationRepository" src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java
echo -e "\n=== Usage of CourseCompetencyRepository ==="
rg "courseCompetencyRepository" src/main/java/de/tum/cit/aet/artemis/atlas/service/learningpath/LearningPathService.java
Length of output: 3532
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1. Everything was great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Ts1. Everything works as expected👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1. No issues were found. Could generate learning paths and also view learning paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approve code after merge
Adaptive learning
: Remove unused ngx graphDevelopment
: Remove unused code related to ngx graph
Checklist
General
Server
Client
Motivation and Context
The nix graph representing competencies and their learning objects was replaced in multiple previous PRs and is unused now.
Description
This PR removes all legacy learning path code for the server and client.
The removed client code was covered better than the average, so the coverage thresholds have to be lowered a bit.
Steps for Testing
Prerequisites:
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
Manual Tests
Summary by CodeRabbit
LearningPathStudentPageComponent
by simplifying route parameter extraction.