-
Notifications
You must be signed in to change notification settings - Fork 301
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 prerequisites not shown in course enrollment
#9358
Adaptive learning
: Fix prerequisites not shown in course enrollment
#9358
Conversation
WalkthroughThe changes in this pull request involve modifications to access control annotations in 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: 4
Outside diff range comments (1)
src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts (1)
Line range hint
1-52
: Overall: Code adheres to guidelines and best practicesThe
CompetencyCardComponent
demonstrates good adherence to Angular style guidelines and TypeScript best practices:
- Proper use of TypeScript features (e.g., strong typing, access modifiers).
- Consistent naming conventions (camelCase for methods and properties, PascalCase for types).
- Effective use of Angular decorators (
@Component
,@Input
).- Clear and concise method implementations.
The recent changes (new input property and method visibility change) integrate well with the existing code structure. The component appears to be part of a lazy-loaded module, which is good for performance.
To further improve the component:
- Consider adding JSDoc comments for the public API (i.e., input properties and public methods) to enhance documentation.
- If this component is used in templates with
*ngFor
, consider implementingChangeDetectionStrategy.OnPush
for potential performance benefits.
Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Files selected for processing (7)
- src/main/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java (2 hunks)
- src/main/webapp/app/course/competencies/competency-card/competency-card.component.html (1 hunks)
- src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts (1 hunks)
- src/main/webapp/app/overview/course-registration/course-registration-prerequisites-modal/course-prerequisites-modal.component.html (1 hunks)
- src/test/java/de/tum/cit/aet/artemis/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (1 hunks)
- src/test/java/de/tum/cit/aet/artemis/competency/CompetencyIntegrationTest.java (1 hunks)
- src/test/java/de/tum/cit/aet/artemis/competency/PrerequisiteIntegrationTest.java (1 hunks)
Additional context used
Path-based instructions (7)
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_importssrc/main/webapp/app/course/competencies/competency-card/competency-card.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.src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts (1)
src/main/webapp/app/overview/course-registration/course-registration-prerequisites-modal/course-prerequisites-modal.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.src/test/java/de/tum/cit/aet/artemis/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: truesrc/test/java/de/tum/cit/aet/artemis/competency/CompetencyIntegrationTest.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: truesrc/test/java/de/tum/cit/aet/artemis/competency/PrerequisiteIntegrationTest.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 (3)
src/test/java/de/tum/cit/aet/artemis/competency/AbstractCompetencyPrerequisiteIntegrationTest.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/competency/CompetencyIntegrationTest.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/competency/PrerequisiteIntegrationTest.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 not posted (11)
src/main/webapp/app/overview/course-registration/course-registration-prerequisites-modal/course-prerequisites-modal.component.html (2)
16-16
: LGTM: New property aligns with PR objectivesThe addition of
[noProgressRings]="true"
to the<jhi-competency-card>
component is consistent with the PR objective of removing competency rings for students who are not yet enrolled. This change enhances the user experience by providing appropriate information based on the user's enrollment status.
Line range hint
7-18
: Excellent use of new Angular syntaxThe template correctly uses the new Angular syntax
@if
and@for
instead of*ngIf
and*ngFor
. This adherence to the latest Angular best practices improves code readability and maintainability.src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts (1)
20-21
: LGTM: New input property added correctlyThe new
noProgressRings
input property is well-implemented. It follows the camelCase naming convention, uses the@Input()
decorator correctly, and has a default value set. This addition enhances the component's flexibility by allowing control over the display of progress rings.src/main/webapp/app/course/competencies/competency-card/competency-card.component.html (1)
61-65
: LGTM! Conditional rendering implemented correctly.The changes effectively implement the conditional rendering of the competency rings component. This aligns well with the PR objective of removing competency rings for students who are not yet enrolled. The use of the new
@if
syntax instead of*ngIf
adheres to the provided coding guidelines for Angular templates.src/test/java/de/tum/cit/aet/artemis/competency/CompetencyIntegrationTest.java (2)
Line range hint
1-380
: Overall structure adheres to coding guidelinesThe test class generally follows the coding guidelines for test files:
- Test methods have descriptive names.
- Tests are small and specific.
- JUnit 5 features like @ParameterizedTest are used.
- Authentication is properly mocked using @WithMockUser annotations.
For consistency, consider applying the @test annotation to all test methods, even those that override superclass methods. For example:
+ @Test @Override List<? extends CourseCompetency> getAllCall(long courseId, HttpStatus expectedStatus) throws Exception { return request.getList("/api/courses/" + courseId + "/competencies", expectedStatus, Competency.class); }
This change would improve consistency and make it clear that these methods are also test cases.
Line range hint
1-380
: Summary of review findings
- The main change in
shouldReturnCompetenciesForStudentOfCourse
method has been addressed, with a suggestion to update the method name for clarity.- The overall structure of the test class adheres well to the coding guidelines for test files.
- A minor suggestion for consistency in applying @test annotations has been provided.
The changes align with the PR objectives of broadening access to course prerequisites and shifting from student-specific to course-level competency evaluations. The test structure supports these changes while maintaining good testing practices.
No further issues were identified. Once the suggested improvements are implemented, the code will be ready for the next stage of the review process.
src/test/java/de/tum/cit/aet/artemis/competency/PrerequisiteIntegrationTest.java (2)
110-110
: LGTM! Improved test method name and implementation.The changes to this test method are well-aligned with our coding guidelines:
- The new method name
shouldReturnCompetenciesForCourse
is more descriptive and accurately reflects the test's purpose, following our test_naming guideline.- The implementation leverages the parent class method, adhering to the util_service_factory_pattern guideline.
- The test remains small and specific, in line with our test_size guideline.
These changes improve the test's clarity and maintainability.
115-116
: Improved test method name, but potential discrepancy in implementation.The changes to this test method align well with our coding guidelines:
- The new method name
shouldReturnCompetenciesForStudentNotInCourse
is more descriptive and follows the "should" naming convention, adhering to our test_naming guideline.- The implementation leverages the parent class method, following the util_service_factory_pattern guideline.
- The test remains small and specific, in line with our test_size guideline.
However, there's a potential issue:
The method name suggests it's testing for a student not in the course, but the implementation is identical to the previous test for a student in the course. This might indicate a discrepancy between the test's intended purpose and its actual implementation.Could you please verify if the implementation correctly tests the scenario for a student not in the course? If not, consider updating either the method name or its implementation to ensure consistency between the test's name and its behavior.
src/main/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java (3)
42-42
: LGTM: New import statement addedThe import statement for
@EnforceAtLeastStudent
is correctly added. This import is necessary for the annotation change in thegetPrerequisitesWithProgress
method.
Line range hint
1-385
: Overall code quality is good, changes are minimal and focusedThe file adheres to the provided coding guidelines:
- Follows CamelCase naming convention
- Adheres to single responsibility principle
- Uses constructor injection for dependencies
- Follows RESTful principles
The changes made are minimal and focused on the PR objective of allowing all students to see prerequisites regardless of enrollment status. The overall code quality is good.
Line range hint
102-106
: Verify prerequisiteService implementation for non-enrolled usersThe implementation of
getPrerequisitesWithProgress
looks correct. However, to ensure it fully meets the PR objective, we should verify that thefindPrerequisitesWithProgressForUserByCourseId
method inprerequisiteService
correctly handles the case where the user is not enrolled in the course.Let's check the implementation of
findPrerequisitesWithProgressForUserByCourseId
:#!/bin/bash # Description: Check the implementation of findPrerequisitesWithProgressForUserByCourseId # Search for findPrerequisitesWithProgressForUserByCourseId method echo "Searching for findPrerequisitesWithProgressForUserByCourseId method:" rg --type java -A 10 "findPrerequisitesWithProgressForUserByCourseId"This will help us ensure that the service method correctly handles non-enrolled users, aligning with the PR objective.
src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts
Show resolved
Hide resolved
src/test/java/de/tum/cit/aet/artemis/competency/CompetencyIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java
Show resolved
Hide resolved
...st/java/de/tum/cit/aet/artemis/competency/AbstractCompetencyPrerequisiteIntegrationTest.java
Outdated
Show resolved
Hide resolved
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
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
9aecf51
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: 1
Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Files selected for processing (1)
- src/test/javascript/spec/component/competencies/competency-card-stub.component.ts (1 hunks)
Additional context used
Path-based instructions (1)
src/test/javascript/spec/component/competencies/competency-card-stub.component.ts (1)
Pattern
src/test/javascript/spec/**/*.ts
: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}
src/test/javascript/spec/component/competencies/competency-card-stub.component.ts
Outdated
Show resolved
Hide resolved
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.
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 besides the use of @input instead of input (). Worked on ts2
src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts
Outdated
Show resolved
Hide resolved
src/test/javascript/spec/component/competencies/competency-card-stub.component.ts
Outdated
Show resolved
Hide resolved
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.
reapprove after merge conflict
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 after merge conflicts works 👍
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.
Maintainer approved
Checklist
General
Server
Client
Motivation and Context
Users got a not authorised exception when trying to see the prerequisites of a course before enrolling.
Description
Changed the authorisation to see prerequisites of a course to all students regardless if they are already enrolled in the course.
Removed the competency rings when viewing the prerequisites before enrolling in a course, since the student does not yet have progress in them.
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
Performance Tests
Test Coverage
Client
Server
Summary by CodeRabbit
Summary by CodeRabbit
New Features
noProgressRings
to the competency card, allowing for conditional rendering of progress rings based on user context.Bug Fixes
getPrerequisitesWithProgress
method, broadening user roles that can access it.Tests