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

Plagiarism checks: Add direct link to plagiarism detection case view #9747

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

AjayvirS
Copy link
Contributor

@AjayvirS AjayvirS commented Nov 11, 2024

Checklist

General

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 client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Fixes #5974 .

In plagiarism cases' page should be a link to view directly the plagiarism detection for the exercises. This issue adds a link for every plagiarism case to the plagiarism detection view for that exercise.

  • Note: as discussed with @MarkusPaulsen and @rabeatwork , this issue was modified to have link near the exercise name instead of the "Appears in x comparison(s)" link for grouped plagiarism submissions of an exercise. The motivation is that every "Appears in..." of one exercise links to the same plagiarism detection view of the exercise, making it redundant.

Description

A routerLink was added to the plagiarism detection view, enabling navigation to the respective course and exercise based on their IDs. A new class was introduced to group plagiarism cases by exercise, improving clarity and organization. Additionally, tests were implemented to verify the functionality of the routerLink.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • At least 2 Exercises (any type) which trigger plagiarism detection

Testing:

  1. Login as instructor and navigate to the assessment dashboard
  2. Go to the plagiarism cases view
    3. Click on the linked "Appears in x comparison(s)" text*
  3. Click on the Exercise name which is linked to the plagiarism detection view for that exercise
  4. Verify if the plagiarism detection view is correctly linked
  • Note: as discussed with @MarkusPaulsen, this issue was modified to link the exercise title instead of the "Appears in x comparison(s)" for every plagiarism submission of an exercise. The motivation is that every "Appears in..." of one exercise links to the plagiarism detection for the same exercise, making it redundant.

x





  • 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

Test Coverage

Class/File Line Coverage Confirmation (assert/expect)
plagiarism-cases-instructor-view.component.ts 97%

Screenshots

image

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced navigation in the plagiarism cases instructor view, allowing users to click through to relevant plagiarism detection pages.
    • Improved display of plagiarism submission counts with dynamic IDs for better tracking.
    • Introduced a new structure for grouping plagiarism cases by exercise, enhancing organization and clarity.
    • Added optional chaining for better error handling in student properties.
  • Style

    • Introduced new styles for text elements, including hover effects to improve user interaction feedback.
  • Tests

    • Expanded test coverage for navigation functionality and user interactions, ensuring robust validation of the component's features.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced instructor view for plagiarism cases with improved navigation and interactivity.
    • Added functionality to view comparisons of plagiarism cases in both English and German.
  • Bug Fixes

    • Improved error handling for undefined student properties in plagiarism cases.
  • Style

    • Introduced new styles for better visual feedback on hover actions.
  • Tests

    • Expanded test suite to include routing capabilities and additional user interaction scenarios.
  • Documentation

    • Updated translation files to include new keys for viewing comparisons.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Nov 11, 2024
@AjayvirS AjayvirS changed the title Development: add direct link to plagiarism detection case view from c… Development: add direct link to plagiarism detection case view Nov 11, 2024
@AjayvirS AjayvirS changed the title Development: add direct link to plagiarism detection case view Development:add direct link to plagiarism detection case view Nov 11, 2024
@AjayvirS AjayvirS changed the title Development:add direct link to plagiarism detection case view Development: Add direct link to plagiarism detection case view Nov 11, 2024
@HawKhiem HawKhiem temporarily deployed to artemis-test4.artemis.cit.tum.de November 12, 2024 17:02 — with GitHub Actions Inactive
HawKhiem
HawKhiem previously approved these changes Nov 12, 2024
Copy link

@HawKhiem HawKhiem 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 TS4. Works as described

Screenshot 2024-11-12 182252
Screenshot 2024-11-12 182304

Copy link
Contributor

@eceeeren eceeeren left a comment

Choose a reason for hiding this comment

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

Hello, can you give a bit more info on how to trigger the plagiarism detection in the test steps?

Copy link
Contributor

@az108 az108 left a comment

Choose a reason for hiding this comment

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

Overall looks good to me , just one small comment

@AjayvirS AjayvirS requested a review from eceeeren November 14, 2024 16:32
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 and nitpick comments (2)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (1)

24-26: Add JSDoc comment to explain the purpose of the property.

The comment explains why the property is needed, but it should be in JSDoc format for better documentation.

-    // method called as html template variable, angular only recognises reference variables in html if they are a property
-    // of the corresponding component class
-    getExerciseUrlSegment = getExerciseUrlSegment;
+    /**
+     * Method called as html template variable.
+     * Angular only recognizes reference variables in html if they are a property of the corresponding component class.
+     */
+    getExerciseUrlSegment = getExerciseUrlSegment;
src/test/javascript/spec/component/plagiarism/plagiarism-cases-instructor-view.component.spec.ts (1)

36-36: Consider extracting test fixtures into a separate file

While the test data is well-structured, consider moving the mock data (exercises, submissions, and cases) into a separate test fixtures file to improve maintainability and reusability across test files.

Example structure:

// src/test/javascript/spec/fixtures/plagiarism-cases.fixtures.ts
export const mockExercises = {
    exercise1: {
        id: 1,
        title: 'Test Exercise 1',
        type: ExerciseType.TEXT,
    } as TextExercise,
    // ... other exercises
};

export const mockPlagiarismSubmissions = {
    submission1: {
        id: 1,
        studentLogin: 'studentA',
    } as PlagiarismSubmission<TextSubmissionElement>,
    // ... other submissions
};

Also applies to: 45-57, 77-77

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a608be0 and d2762cb.

📒 Files selected for processing (5)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html (3 hunks)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (3 hunks)
  • src/main/webapp/i18n/de/plagiarism.json (1 hunks)
  • src/main/webapp/i18n/en/plagiarism.json (1 hunks)
  • src/test/javascript/spec/component/plagiarism/plagiarism-cases-instructor-view.component.spec.ts (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html
🧰 Additional context used
📓 Path-based instructions (3)
src/main/webapp/i18n/de/plagiarism.json (1)

Pattern src/main/webapp/i18n/de/**/*.json: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".

src/test/javascript/spec/component/plagiarism/plagiarism-cases-instructor-view.component.spec.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/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.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

🪛 eslint
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[error] 194-194: Insert

(prettier/prettier)

🔇 Additional comments (7)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (2)

21-21: LGTM! Type safety improvement.

The change from any to GroupedPlagiarismCases type improves type safety and code maintainability.


171-193: LGTM! Well-structured grouping logic with proper type safety.

The new method effectively groups plagiarism cases by exercise while maintaining type safety. The implementation:

  1. Uses proper TypeScript type annotations
  2. Handles undefined exercise IDs gracefully
  3. Initializes groups and maintains the exercise list
  4. Uses reduce for efficient grouping

Let's verify the usage of this grouping method:

✅ Verification successful

Grouping logic is correctly implemented and properly used

The verification confirms:

  • The method is used in the component to populate groupedPlagiarismCases
  • The GroupedPlagiarismCases interface is properly defined in a dedicated types file with correct typing ([exerciseId: number]: PlagiarismCase[])
  • The implementation aligns with the interface definition and its usage
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of getGroupedPlagiarismCasesByExercise method
# and ensure it's called appropriately

# Search for method calls
rg "getGroupedPlagiarismCasesByExercise" -A 2

# Search for GroupedPlagiarismCases type usage
ast-grep --pattern 'interface GroupedPlagiarismCases {
  $$$
}'

Length of output: 1584

src/main/webapp/i18n/en/plagiarism.json (1)

117-118: LGTM! Clear and consistent translations.

The new translations "studentNotified" and "viewComparisons" are clear, concise, and follow the existing translation patterns.

src/main/webapp/i18n/de/plagiarism.json (1)

117-118: LGTM! Translations follow German language guidelines.

The new translations:

  1. Use informal style (dutzen) as required
  2. Maintain consistency with English translations
  3. Follow natural German language patterns
src/test/javascript/spec/component/plagiarism/plagiarism-cases-instructor-view.component.spec.ts (3)

4-4: LGTM: Import statements are well-organized and necessary

The new imports are properly organized and support the added routing functionality testing.

Also applies to: 14-25


106-106: LGTM: Test configuration follows Angular testing best practices

The test module setup properly configures the necessary dependencies, mock components, and services for isolated component testing.

Also applies to: 110-120


232-243: LGTM with suggestions for additional test coverage

The navigation test is well-structured but could be enhanced with additional test cases:

  1. Navigation with invalid exercise ID
  2. Navigation when course ID is missing
  3. Error handling scenarios

Let's verify the test coverage for navigation-related code:

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 10, 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: 1

🧹 Outside diff range and nitpick comments (1)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (1)

24-26: Enhance the comment to be more specific about Angular's template behavior

While the implementation is correct, the comment could be more specific about why Angular needs this pattern. Consider updating it to:

-// method called as html template variable, angular only recognises reference variables in html if they are a property
-// of the corresponding component class
+// Angular's template engine requires methods used in templates to be properties of the component class
+// This allows the template to maintain a stable reference to the getExerciseUrlSegment function
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d2762cb and 6ce4eec.

📒 Files selected for processing (2)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html (3 hunks)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.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

🔇 Additional comments (4)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (4)

6-6: LGTM: Import and decorator changes follow Angular best practices

The new imports and styleUrls addition are well-structured and follow Angular's style guide.

Also applies to: 9-9, 15-15


21-21: Great improvement: Enhanced type safety with GroupedPlagiarismCases

The change from any to a specific type improves type safety and code maintainability.


48-48: LGTM: Good separation of concerns

Moving the grouping logic to a dedicated method improves code organization and readability.


6-6: Verify the implementation meets the PR requirements

The changes support adding direct links to the plagiarism detection view by providing URL generation capabilities. However, let's verify that all necessary components are in place.

Also applies to: 26-26

✅ Verification successful

Implementation aligns with PR requirements

The changes support the PR objectives by correctly implementing direct links to plagiarism detection case views:

  • The getExerciseUrlSegment function is properly implemented in exercise.model.ts to generate correct URL segments based on exercise type
  • The template correctly uses the function in routerLink to create navigation links to plagiarism views
  • The component properly imports and exposes the function for template usage
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the template uses the URL generation and proper routing

# Check if the template uses getExerciseUrlSegment for routing
rg -l "getExerciseUrlSegment" "src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html"

# Check if there are any tests covering the navigation
rg -l "routerLink.*getExerciseUrlSegment" "src/test/javascript/spec/component/plagiarism/**/*spec.ts"

Length of output: 447


Script:

#!/bin/bash
# Let's verify the implementation more thoroughly

# Check the actual usage of getExerciseUrlSegment in the template
rg -A 5 "getExerciseUrlSegment" "src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html"

# Check if there are any tests in a broader scope
fd ".*spec.ts$" src/test/javascript/spec

# Check the implementation of getExerciseUrlSegment
rg -A 5 "getExerciseUrlSegment" "src/main/webapp/app/entities/exercise.model.ts"

# Check the component implementation
rg -A 5 "getExerciseUrlSegment" "src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts"

Length of output: 66351


Script:

#!/bin/bash
# Let's check the implementation of getExerciseUrlSegment and its usage

# Check the implementation of getExerciseUrlSegment in exercise.model.ts
ast-grep --pattern 'export function getExerciseUrlSegment($_) { $$$ }'

# Check the component implementation for routing usage
rg -A 10 "getExerciseUrlSegment" "src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts"

# Check if there are any plagiarism-related test files in a different location
fd "plagiarism.*spec.ts$" src/test/javascript

Length of output: 2444


Script:

#!/bin/bash
# Let's check the test implementation and exercise model

# Check the plagiarism test implementation for routing tests
rg -A 10 "getExerciseUrlSegment" "src/test/javascript/spec/component/plagiarism/plagiarism-cases-instructor-view.component.spec.ts"

# Check the exercise model implementation since ast-grep didn't find it
rg -A 5 "export function getExerciseUrlSegment" "src/main/webapp/app/entities/exercise.model.ts"

# Check the template usage in more detail
rg -B 2 -A 2 "getExerciseUrlSegment" "src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html"

Length of output: 1050

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6ce4eec and 9b21bc9.

📒 Files selected for processing (1)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.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

🪛 Biome (1.9.4)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[error] 179-179: Expected an expression but instead found 'case => case.exercise'.

Expected an expression here.

(parse)

🪛 GitHub Check: client-compilation
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.

🪛 GitHub Check: client-tests-selected
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.

🪛 GitHub Check: client-tests
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.

🔇 Additional comments (6)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (6)

6-6: LGTM: Import additions enhance type safety and support new linking functionality

The new imports properly support the PR objectives by providing necessary types and utilities for direct linking to plagiarism detection.

Also applies to: 9-9


15-15: LGTM: Component styling follows Angular best practices

The addition of styleUrls properly separates styling concerns into a dedicated SCSS file.


21-21: LGTM: Type safety improvement

Replacing any with GroupedPlagiarismCases enhances type safety and maintainability.


24-26: Consider enhancing the documentation

While the comment explains why the property is needed, it could be more specific about Angular's template binding mechanism.

Consider this improved documentation:

-// method called as html template variable, angular only recognises reference variables in html if they are a property
-// of the corresponding component class
+/**
+ * Exposes the getExerciseUrlSegment utility for template usage.
+ * Angular requires template-referenced functions to be class properties
+ * to enable proper binding and change detection.
+ */

171-197: LGTM: Well-structured grouping implementation

The implementation:

  • Pre-collects exercises to avoid side effects
  • Includes proper null safety checks
  • Uses type predicates for filtering
  • Follows functional programming practices

This aligns well with the PR objectives by preparing data for the plagiarism detection view.

🧰 Tools
🪛 Biome (1.9.4)

[error] 179-179: Expected an expression but instead found 'case => case.exercise'.

Expected an expression here.

(parse)

🪛 GitHub Check: client-compilation

[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.

🪛 GitHub Check: client-tests-selected

[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.

🪛 GitHub Check: client-tests

[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


[failure] 179-179:
Argument expression expected.


26-26: Verify template implementation of plagiarism detection links

Let's verify that the template properly utilizes the getExerciseUrlSegment function for navigation.

✅ Verification successful

Template implementation of plagiarism detection links is correct

The verification shows proper implementation:

  • The getExerciseUrlSegment function is correctly used in both template files for navigation
  • In the instructor view, it's used to create links to plagiarism detection via [routerLink]="['/course-management', courseId, getExerciseUrlSegment(exercise.type), exercise.id, 'plagiarism']"
  • In the detail view, it's used similarly for exercise navigation and plagiarism detection links in the dropdown menu
  • The routing structure is consistent with the URL pattern used in the templates
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify template usage of getExerciseUrlSegment and proper routing setup

# Check template implementation
rg -l "getExerciseUrlSegment" --type html

# Verify router configuration includes plagiarism detection routes
rg -l "plagiarism.*detection" --type ts | grep -i "routing"

Length of output: 335


Script:

#!/bin/bash
# Let's check the actual template implementation to verify proper usage
cat src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html

# Also check the detail view template
cat src/main/webapp/app/course/plagiarism-cases/instructor-view/detail-view/plagiarism-case-instructor-detail-view.component.html

# Let's also verify the routing setup more broadly
rg -l "plagiarism" --type ts | grep -i "route"

Length of output: 18347

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 and nitpick comments (1)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (1)

179-179: Fix arrow function parentheses to match style guidelines

The static analysis tools indicate a style violation.

-            .map(plagiarismCase => plagiarismCase.exercise)
+            .map((plagiarismCase) => plagiarismCase.exercise)
🧰 Tools
🪛 eslint

[error] 179-179: Replace plagiarismCase with (plagiarismCase)

(prettier/prettier)

🪛 GitHub Check: client-style

[failure] 179-179:
Replace plagiarismCase with (plagiarismCase)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9b21bc9 and 2430998.

📒 Files selected for processing (1)
  • src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.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

🪛 eslint
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[error] 179-179: Replace plagiarismCase with (plagiarismCase)

(prettier/prettier)

🪛 GitHub Check: client-style
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts

[failure] 179-179:
Replace plagiarismCase with (plagiarismCase)

🔇 Additional comments (6)
src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts (6)

6-6: LGTM: Import changes align with new functionality

The new imports support URL generation for exercises and improve type safety through the GroupedPlagiarismCases type.

Also applies to: 9-9


15-15: LGTM: Component styling follows Angular best practices

The addition of styleUrls properly encapsulates component-specific styles.


21-21: LGTM: Improved type safety for grouped cases

The explicit typing with GroupedPlagiarismCases enhances code reliability and maintainability.


24-26: Consider using a proper getter method instead of property assignment

While the comment explains why the property assignment is needed, a getter method would be a cleaner approach and more aligned with Angular best practices.

-    // method called as html template variable, angular only recognises reference variables in html if they are a property
-    // of the corresponding component class
-    getExerciseUrlSegment = getExerciseUrlSegment;
+    getExerciseUrlSegment(exercise: Exercise): string {
+        return getExerciseUrlSegment(exercise);
+    }

48-48: LGTM: Improved code organization

Moving the grouping logic to a dedicated method enhances maintainability and readability.


171-197: LGTM: Well-implemented grouping logic with proper safety checks

The implementation includes:

  • Pre-collection of exercises to avoid side effects
  • Proper null safety checks
  • Clear separation of group initialization and assignment
🧰 Tools
🪛 eslint

[error] 179-179: Replace plagiarismCase with (plagiarismCase)

(prettier/prettier)

🪛 GitHub Check: client-style

[failure] 179-179:
Replace plagiarismCase with (plagiarismCase)

Copy link

@sachmii sachmii 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 TS1, reapprove

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!) ready for review tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

Plagiarism checks: Link the plagiarism detection from the plagiarism case view.