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 prerequisites not shown in course enrolment #9358

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

JohannesStoehr
Copy link
Contributor

@JohannesStoehr JohannesStoehr commented Sep 23, 2024

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 multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.

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:

  • 1 Instructor
  • 1 Student not enrolled in the course
  1. Log in to Artemis as instructor
  2. Create a prerequisite in the course
  3. Enable self enrolment in the course settings
  4. Try to enrol in the course as student and view the 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

  • 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

Summary by CodeRabbit

  • New Features

    • Added a new input property noProgressRings to the competency card, allowing for conditional rendering of progress rings based on user context.
    • Updated competency card components to reflect the new input property, enhancing the display logic in various contexts.
  • Bug Fixes

    • Modified access control for the getPrerequisitesWithProgress method, broadening user roles that can access it.
  • Tests

    • Renamed and updated test methods to reflect a shift in focus from student-specific competencies to course-related competencies.

Copy link

coderabbitai bot commented Sep 23, 2024

Walkthrough

The changes in this pull request involve modifications to access control annotations in the PrerequisiteResource.java file, updates to the rendering logic in the competency-card.component.html and competency-card.component.ts, and renaming of test methods in several test classes. The updates aim to broaden access for certain methods, introduce new input properties for components, and realign test methods with a focus on course-related competencies rather than student-specific ones.

Changes

File Change Summary
src/main/java/de/tum/cit/aet/artemis/atlas/web/PrerequisiteResource.java Added @EnforceAtLeastStudent annotation and replaced @EnforceAtLeastStudentInCourse for method getPrerequisitesWithProgress, altering access control.
src/main/webapp/app/course/competencies/competency-card/competency-card.component.html Introduced conditional rendering for <jhi-competency-rings> based on noProgressRings variable.
src/main/webapp/app/course/competencies/competency-card/competency-card.component.ts Added new input property noProgressRings and changed getIcon method visibility from public to protected.
src/main/webapp/app/overview/course-registration/course-registration-prerequisites-modal/course-prerequisites-modal.component.html Added [noProgressRings]="true" to <jhi-competency-card>, maintaining existing properties.
src/test/java/de/tum/cit/aet/artemis/competency/AbstractCompetencyPrerequisiteIntegrationTest.java Renamed method shouldReturnCompetenciesForStudentOfCourse to shouldReturnCompetenciesForCourse, with no changes to parameters or logic.
src/test/java/de/tum/cit/aet/artemis/competency/CompetencyIntegrationTest.java Updated test method to call super.shouldReturnCompetenciesForCourse(new Competency()) instead of the old method, aligning with new naming conventions.
src/test/java/de/tum/cit/aet/artemis/competency/PrerequisiteIntegrationTest.java Renamed methods to reflect a focus on course competencies, updating shouldReturnCompetenciesForStudentOfCourse to shouldReturnCompetenciesForCourse.

Possibly related PRs

Suggested labels

tests, server, client, enhancement

Suggested reviewers

  • JohannesWt
  • MaximilianAnzinger
  • egekurt123
  • N0W0RK
  • Jan-Thurner
  • sarpsahinalp
  • coolchock

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>, please review it.
    -- 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

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.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels Sep 23, 2024
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: 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 practices

The CompetencyCardComponent demonstrates good adherence to Angular style guidelines and TypeScript best practices:

  1. Proper use of TypeScript features (e.g., strong typing, access modifiers).
  2. Consistent naming conventions (camelCase for methods and properties, PascalCase for types).
  3. Effective use of Angular decorators (@Component, @Input).
  4. 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:

  1. Consider adding JSDoc comments for the public API (i.e., input properties and public methods) to enhance documentation.
  2. If this component is used in templates with *ngFor, consider implementing ChangeDetectionStrategy.OnPush for potential performance benefits.
Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 00f38c0 and 9a7e5dd.

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_imports

src/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)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

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

src/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: true

src/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 objectives

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

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

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

The test class generally follows the coding guidelines for test files:

  1. Test methods have descriptive names.
  2. Tests are small and specific.
  3. JUnit 5 features like @ParameterizedTest are used.
  4. 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

  1. The main change in shouldReturnCompetenciesForStudentOfCourse method has been addressed, with a suggestion to update the method name for clarity.
  2. The overall structure of the test class adheres well to the coding guidelines for test files.
  3. 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:

  1. The new method name shouldReturnCompetenciesForCourse is more descriptive and accurately reflects the test's purpose, following our test_naming guideline.
  2. The implementation leverages the parent class method, adhering to the util_service_factory_pattern guideline.
  3. 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:

  1. The new method name shouldReturnCompetenciesForStudentNotInCourse is more descriptive and follows the "should" naming convention, adhering to our test_naming guideline.
  2. The implementation leverages the parent class method, following the util_service_factory_pattern guideline.
  3. 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 added

The import statement for @EnforceAtLeastStudent is correctly added. This import is necessary for the annotation change in the getPrerequisitesWithProgress method.


Line range hint 1-385: Overall code quality is good, changes are minimal and focused

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

The implementation of getPrerequisitesWithProgress looks correct. However, to ensure it fully meets the PR objective, we should verify that the findPrerequisitesWithProgressForUserByCourseId method in prerequisiteService 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.


getIcon = getIcon;
protected readonly getIcon = getIcon;
Copy link

Choose a reason for hiding this comment

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

Approved: Method visibility change enhances encapsulation

The change of getIcon to a protected, readonly property is a good improvement. It enhances encapsulation by restricting access and ensures immutability.

However, for consistency and clarity, consider the following minor suggestion:

Consider moving this line closer to other class properties for better organization. For example, you could place it right after the @Input properties:

@Input() noProgressRings = false;

protected readonly getIcon = getIcon;

constructor(public translateService: TranslateService) {}

This arrangement would group all class properties together, improving readability.

@@ -107,7 +107,7 @@ List<? extends CourseCompetency> getAllCall(long courseId, HttpStatus expectedSt
@Test
@WithMockUser(username = TEST_PREFIX + "student1", roles = "USER")
void shouldReturnCompetenciesForStudentOfCourse() throws Exception {
super.shouldReturnCompetenciesForStudentOfCourse(new Competency());
super.shouldReturnCompetenciesForCourse(new Competency());
Copy link

Choose a reason for hiding this comment

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

Update method name to reflect new behavior

The method name shouldReturnCompetenciesForStudentOfCourse no longer accurately describes the test's behavior. The implementation now calls shouldReturnCompetenciesForCourse, which aligns with the PR objective of allowing all students to see course prerequisites regardless of enrollment status.

Consider updating the method name to better reflect its new purpose. For example:

-    void shouldReturnCompetenciesForStudentOfCourse() throws Exception {
+    void shouldReturnCompetenciesForCourse() throws Exception {
         super.shouldReturnCompetenciesForCourse(new Competency());
     }

This change would make the test method name consistent with its implementation and the overall PR objectives.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
super.shouldReturnCompetenciesForCourse(new Competency());
void shouldReturnCompetenciesForCourse() throws Exception {
super.shouldReturnCompetenciesForCourse(new Competency());
}

@@ -97,7 +98,7 @@ public PrerequisiteResource(CourseRepository courseRepository, AuthorizationChec
* @return the ResponseEntity with status 200 (OK) and with body the found prerequisites
*/
@GetMapping("courses/{courseId}/prerequisites")
@EnforceAtLeastStudentInCourse
@EnforceAtLeastStudent
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Multiple usages of @EnforceAtLeastStudentInCourse found

The annotation change to @EnforceAtLeastStudent was applied in PrerequisiteResource.java. However, the following files still use @EnforceAtLeastStudentInCourse, which may introduce security vulnerabilities if not updated:

  • src/main/java/de/tum/cit/aet/artemis/iris/web/IrisCourseChatSessionResource.java
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/LearningPathResource.java
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/CourseCompetencyResource.java
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/CompetencyResource.java
  • src/main/java/de/tum/cit/aet/artemis/atlas/web/MetricsResource.java
  • src/test/java/de/tum/cit/aet/artemis/aspects/resources/EnforceRoleInCourseResource.java

Please update all instances of @EnforceAtLeastStudentInCourse to @EnforceAtLeastStudent to ensure consistent access control across the codebase.

Analysis chain

Verify impact of broadened access control

The annotation change from @EnforceAtLeastStudentInCourse to @EnforceAtLeastStudent aligns with the PR objective of allowing all students to see prerequisites, regardless of their enrollment status. However, we should verify that this change doesn't introduce any security vulnerabilities.

Let's run a script to check for any other usages of @EnforceAtLeastStudentInCourse in the codebase:

This script will help us ensure that the change is consistent across the codebase and that there are no unintended side effects.


Let's run a corrected script to check for any other usages of @EnforceAtLeastStudentInCourse in the codebase:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other usages of @EnforceAtLeastStudentInCourse

# Search for @EnforceAtLeastStudentInCourse usage
echo "Searching for @EnforceAtLeastStudentInCourse usage:"
rg --type java "@EnforceAtLeastStudentInCourse"

# Search for getPrerequisitesWithProgress method usage
echo "Searching for getPrerequisitesWithProgress method usage:"
rg --type java "getPrerequisitesWithProgress"

Length of output: 2516


Script:

#!/bin/bash
# Description: Check for other usages of @EnforceAtLeastStudentInCourse

# Search for @EnforceAtLeastStudentInCourse usage
echo "Searching for @EnforceAtLeastStudentInCourse usage:"
rg --type java "@EnforceAtLeastStudentInCourse"

# Search for getPrerequisitesWithProgress method usage
echo "Searching for getPrerequisitesWithProgress method usage:"
rg --type java "getPrerequisitesWithProgress"

Length of output: 2454

@@ -227,7 +227,7 @@ void shouldReturnBadRequestForWrongCourse() throws Exception {
abstract List<? extends CourseCompetency> getAllCall(long courseId, HttpStatus expectedStatus) throws Exception;

// Test
void shouldReturnCompetenciesForStudentOfCourse(CourseCompetency newCompetency) throws Exception {
void shouldReturnCompetenciesForCourse(CourseCompetency newCompetency) throws Exception {
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Old Method Name Still Referenced in Other Test Classes

The following test classes still contain references to shouldReturnCompetenciesForStudentOfCourse. Please update these method names to align with the new naming convention:

  • src/test/java/de/tum/cit/aet/artemis/competency/PrerequisiteIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/competency/CompetencyIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/competency/CourseCompetencyIntegrationTest.java
Analysis chain

LGTM! Verify impact on other test classes.

The method name change from shouldReturnCompetenciesForStudentOfCourse to shouldReturnCompetenciesForCourse aligns well with the PR objectives of allowing all students to see prerequisites regardless of enrollment status. This change shifts the focus from student-specific competencies to course-wide competencies.

To ensure this change doesn't affect other parts of the codebase, please run the following script:

If the script returns any results, please update those references accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any references to the old method name in other test classes

# Search for any references to the old method name
rg --type java "shouldReturnCompetenciesForStudentOfCourse" src/test/java

Length of output: 703

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

code

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.

Code LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix client Pull requests that update TypeScript code. (Added Automatically!) ready for review server Pull requests that update Java code. (Added Automatically!) small tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

3 participants