Skip to content

General: Add subgrouping to sidebar for lectures and exercises #10608

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

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

Conversation

eylulnc
Copy link
Contributor

@eylulnc eylulnc commented Mar 30, 2025

Checklist

General

Client

  • 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 integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

This PR introduces consistent sub‐grouping for exercises (and lectures). It allows us to display items in sections by weekly buckets when there are more than 5 items.

Description

  • Added a new method to group items by timeframe (past, current and future) and further subdivide them by week if the item count is over 5.
  • Displays week the items belongs, if no date provided inside these time frame sit will add a title with No Date.
  • No subgrouping happen if the accordion is No Date.
  • Integrated it into the sidebar accordion for consistent UI/UX.

Steps for Testing

Prerequisites::
Course with at least 6 exercise or lecture in the same section (Current, Past or Future)

  1. Log in as an Instructor or Student.
  2. Navigate to a course with many exercises (over 5).
  3. Verify that exercises/lectures are now subdivided into weekly sections (sub‐headers) if the total is more than 5.

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Client

Client

Class/File Line Coverage Confirmation (assert/expect)
course-overview.service.ts 92.68% ✅ ❌
sidebar-accordion.component.ts 95.83% ✅ ❌
sidebar.ts not found (modified)
week-grouping.util.ts 100%

Screenshots

Screenshot 2025-04-21 at 22 16 14 Screenshot 2025-04-21 at 20 11 18

Summary by CodeRabbit

  • New Features

    • Enhanced lecture cards to include start dates for improved scheduling visibility.
    • Sidebar now organizes items into weekly groups, displaying week ranges for better contextual navigation.
  • Tests

    • Added comprehensive tests to verify the weekly grouping functionality and correct handling of date-based groupings.

@github-project-automation github-project-automation bot moved this to Work In Progress in Artemis Development Mar 30, 2025
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) core Pull requests that affect the corresponding module labels Mar 30, 2025
@eylulnc eylulnc added the small label Mar 30, 2025
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report202 ran195 passed3 skipped4 failed59m 46s 12ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/exam/ExamParticipation.spec.ts
ts.Exam participation › Programming exam with Git submissions › Participates in exam by Git submission using ssh❌ failure5m 15s 214ms
e2e/exercise/programming/ProgrammingExerciseParticipation.spec.ts
ts.Programming exercise participation › Programming exercise participation using secure git › Programming exercise participation using SSH › Makes a git submission using SSH with RSA key❌ failure4m 42s 712ms
ts.Programming exercise participation › Programming exercise participation using secure git › Programming exercise participation using SSH › Makes a git submission using SSH with ED25519 key❌ failure4m 44s 994ms
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure1m 46s 790ms

@eylulnc eylulnc marked this pull request as ready for review March 30, 2025 18:45
@eylulnc eylulnc requested a review from a team as a code owner March 30, 2025 18:45
@eylulnc eylulnc removed the small label Mar 30, 2025
Copy link
Contributor

coderabbitai bot commented Mar 30, 2025

Walkthrough

This pull request extends the data model for lectures by introducing a new startDate property to lecture card items and enhances the sidebar accordion component to group items by week. It adds new methods, an interface, and constants to structure and manage week-based groupings, and modifies the HTML template to display these groups. Additional tests have been implemented to verify the new grouping logic using the day.js library for date handling.

Changes

File(s) Change Summary
src/main/webapp/app/core/course/overview/course-overview.service.ts Added a startDate property to the lectureCardItem object in the mapLectureToSidebarCardElement method.
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts
Modified the HTML template to iterate over week groups and added new grouping logic in the component. Introduced the WeekGroup interface, constant MIN_ITEMS_TO_GROUP_BY_WEEK, and methods getWeekKey and getGroupedByWeek for grouping items by week.
src/main/webapp/app/shared/types/sidebar.ts Added an optional startDate?: dayjs.Dayjs; property to the SidebarCardElement interface.
src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts Added new test cases to verify the week grouping functionality and date-based grouping behavior, including integration with the day.js library.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SidebarAccordionComponent
    participant dayjs

    User->>SidebarAccordionComponent: Trigger sidebar render
    SidebarAccordionComponent->>SidebarAccordionComponent: Call getGroupedByWeek(groupKey)
    SidebarAccordionComponent->>dayjs: Compute week key for each item
    dayjs-->>SidebarAccordionComponent: Return computed week key
    SidebarAccordionComponent->>SidebarAccordionComponent: Group items by week using the week keys
    SidebarAccordionComponent-->>User: Return grouped sidebar data for rendering
Loading

Possibly related PRs

  • Communication: Add recents section to sidebar #10033: The changes in the main PR, which add a startDate property to the lectureCardItem object in the CourseOverviewService, are related to the retrieved PR that introduces a "Recents" section in the sidebar, which utilizes the startDate for displaying relevant conversations.
  • Lectures: Group lectures in sidebar by start and end date #8588: The changes in the main PR, which add a startDate property to the lectureCardItem object, are related to the retrieved PR that introduces a new function for grouping lectures by their start and end dates, as both modifications involve the CourseOverviewService and the handling of lecture data.
  • Lectures: Validate the date for lecture units #9765: The changes in the main PR, which add a startDate property to the lectureCardItem object, are related to the retrieved PR that focuses on client-side date validation for lecture units, as both involve modifications to the handling of date-related properties within the context of lectures.

Suggested labels

feature, ready to merge, component:Communication

Suggested reviewers

  • florian-glombik
  • rabeatwork
  • HawKhiem
  • krusche
  • anian03
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link
Contributor

@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

🧹 Nitpick comments (2)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (2)

108-112: Consider adding locale support for internationalization.

The getWeekKey method correctly formats the week range, but it doesn't account for locale-specific date formatting, which could be important for internationalization in Artemis.

private getWeekKey(date: dayjs.Dayjs): string {
    const weekStart = date.startOf('isoWeek');
    const weekEnd = date.endOf('isoWeek');
-   return `${weekStart.format('DD MMM')} - ${weekEnd.format('DD MMM YYYY')}`;
+   return `${weekStart.format('DD MMM')} - ${weekEnd.format('DD MMM YYYY')}`.localeData();
}

114-159: Improve date parsing in the sorting function.

The implementation correctly groups items by week and handles various edge cases. However, the date parsing for sorting (lines 155-156) doesn't include the year, which could lead to incorrect sorting for weeks spanning different years.

// In the sorting function, parse the complete date string including year
- const aDate = dayjs(a.weekRange.split(' - ')[0], 'DD MMM');
- const bDate = dayjs(b.weekRange.split(' - ')[0], 'DD MMM');
+ const aDate = dayjs(a.weekRange.split(' - ')[1], 'DD MMM YYYY').startOf('isoWeek');
+ const bDate = dayjs(b.weekRange.split(' - ')[1], 'DD MMM YYYY').startOf('isoWeek');
- return aDate.isBefore(bDate) ? -1 : 1;
+ return aDate.isBefore(bDate) ? -1 : aDate.isAfter(bDate) ? 1 : 0;
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65964e5 and 829cfdb.

📒 Files selected for processing (5)
  • src/main/webapp/app/core/course/overview/course-overview.service.ts (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (2 hunks)
  • src/main/webapp/app/shared/types/sidebar.ts (1 hunks)
  • src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`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:PascalC...

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/shared/types/sidebar.ts
  • src/main/webapp/app/core/course/overview/course-overview.service.ts
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts
`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_logi...

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/shared/sidebar/sidebar-accordion.component.spec.ts
`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/**/*.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/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html
🧬 Code Definitions (1)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (1)
src/main/webapp/app/shared/types/sidebar.ts (1)
  • SidebarCardElement (48-165)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (8)
src/main/webapp/app/shared/types/sidebar.ts (1)

159-162: Good addition of a well-documented property.

The startDate property is properly documented with JSDoc comments and follows the correct typing pattern with the optional modifier. This aligns well with the PR objective of enhancing the sidebar to support week-based grouping.

src/main/webapp/app/core/course/overview/course-overview.service.ts (1)

311-311: LGTM: Consistent implementation of the startDate property.

The property is correctly assigned from the lecture object, matching the interface definition and enabling the week-based grouping functionality.

src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html (1)

27-49: Well-structured implementation of weekly subgrouping.

The template changes effectively implement the weekly subgrouping functionality with a clean UI hierarchy. The code:

  1. Changes from direct iteration over entities to using the new getGroupedByWeek method
  2. Adds conditional display of week ranges when appropriate
  3. Maintains consistent styling with bg-body for content and bg-module for containers

These changes properly implement the PR objective of organizing items into weekly buckets when there are more than five items present.

src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts (2)

15-18: Good setup of dayjs with proper plugin extension.

Correctly importing and extending dayjs with the isoWeek plugin ensures consistent date handling throughout the tests.


161-259: Comprehensive test coverage for the new weekly grouping functionality.

The tests thoroughly verify the behavior of the getGroupedByWeek method under various conditions:

  1. Exam-type groups are handled correctly (lines 161-178)
  2. Small groups and filtered groups maintain their structure (lines 181-208)
  3. Large groups (>5 items) are properly split by week (lines 210-226)
  4. Items with only startDateWithTime are correctly grouped (lines 228-239)
  5. Items without dates are properly handled (lines 241-259)

The parameterized test approach reduces code duplication and the assertions verify both structure and content of the returned groups.

src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (3)

11-14: Good setup of dayjs with isoWeek plugin.

The dayjs setup with isoWeek plugin is correctly implemented, which will provide the necessary date manipulation capabilities for week-based grouping.


16-19: Well-defined interface for week grouping.

The WeekGroup interface provides a clear structure for organizing sidebar items by their week ranges, with appropriate property names and types.


21-21: Good use of a named constant.

Using a named constant for the threshold value instead of a magic number improves code readability and maintainability.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 30, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de March 30, 2025 18:56 Inactive
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Tbh. I'm not entirley sure what's going on there, but it seems the weeks themselves are not orderd by date any more? My guess is, that you're not taking the year into account
image

@github-project-automation github-project-automation bot moved this from Work In Progress to Ready For Review in Artemis Development Mar 30, 2025
Copy link
Contributor

@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

🧹 Nitpick comments (5)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (5)

115-142: Extract date access logic to a helper method.

The repeated pattern of accessing dates via item.exercise?.dueDate || item.startDateWithTime || item.startDate appears multiple times in the code. Consider extracting this to a helper method to improve readability and maintainability.

+    private getItemDate(item: SidebarCardElement): dayjs.Dayjs | undefined {
+        return item.exercise?.dueDate || item.startDateWithTime || item.startDate;
+    }

     getGroupedByWeek(groupKey: string): WeekGroup[] {
         const items = this.groupedData[groupKey].entityData;

         // Apply search filter
         const filteredItems = this.searchValue
             ? items.filter((item) => item.title?.toLowerCase().includes(this.searchValue.toLowerCase()) || item.type?.toLowerCase().includes(this.searchValue.toLowerCase()))
             : items;

         // For exams, always return as a single group without week ranges
         if (groupKey === 'real' || groupKey === 'test' || groupKey === 'attempt') {
             return [{ weekRange: '', items: filteredItems }];
         }

         if (filteredItems.length <= MIN_ITEMS_TO_GROUP_BY_WEEK || this.searchValue) {
             return [{ weekRange: '', items: filteredItems }];
         }

         const weekGroups = new Map<string, SidebarCardElement[]>();

         for (const item of filteredItems) {
-            const date = item.exercise?.dueDate || item.startDateWithTime || item.startDate;
+            const date = this.getItemDate(item);
             if (!date) {
                 const noDateKey = 'No Date';
                 const noDateGroup = weekGroups.get(noDateKey) || [];
                 noDateGroup.push(item);
                 weekGroups.set(noDateKey, noDateGroup);
                 continue;
             }

150-160: Use the same helper method for sorting logic.

The date access pattern repeats in the sorting logic. Using the suggested helper method would also simplify this section.

         // Sort items within each group by date (newest first)
         for (const [, items] of weekGroups) {
             items.sort((a, b) => {
-                const dateA = a.exercise?.dueDate || a.startDateWithTime || a.startDate;
-                const dateB = b.exercise?.dueDate || b.startDateWithTime || b.startDate;
+                const dateA = this.getItemDate(a);
+                const dateB = this.getItemDate(b);
                 if (!dateA && !dateB) return 0;
                 if (!dateA) return 1;
                 if (!dateB) return -1;
                 return dateB.valueOf() - dateA.valueOf();
             });
         }

162-186: Consider adding comments to complex sorting logic.

The sorting logic for week groups is quite complex. Adding comments would enhance code readability and make future maintenance easier.

         return Array.from(weekGroups.entries())
             .map(([weekRange, items]) => {
                 const displayRange = weekRange === 'No Date' ? weekRange : weekRange.split(' - ').slice(1).join(' - ');
                 return { weekRange: displayRange, items };
             })
             .sort((a, b) => {
+                // Always place items with no date at the end
                 if (a.weekRange === 'No Date') return 1;
                 if (b.weekRange === 'No Date') return -1;

+                // Find the full week key with year information
                 const aFullKey = Array.from(weekGroups.keys()).find((key) => key.includes(a.weekRange));
                 const bFullKey = Array.from(weekGroups.keys()).find((key) => key.includes(b.weekRange));

                 if (!aFullKey || !bFullKey) return 0;

+                // Sort by year first
                 const [aYear] = aFullKey.split(' - ');
                 const [bYear] = bFullKey.split(' - ');
                 if (aYear !== bYear) {
                     return Number(bYear) - Number(aYear);
                 }

+                // For the same year, sort by date (newest first)
                 const aDate = dayjs(a.weekRange.split(' - ')[0], 'DD MMM');
                 const bDate = dayjs(b.weekRange.split(' - ')[0], 'DD MMM');
                 return bDate.valueOf() - aDate.valueOf();
             });

115-186: Consider breaking down the complex grouping method.

The getGroupedByWeek method is quite long and handles multiple responsibilities. Consider breaking it down into smaller helper methods to improve maintainability and testability.

You could extract logic for:

  1. Filtering items
  2. Determining if grouping should be applied
  3. Creating the week groups
  4. Sorting the groups

This would make the main method more concise and easier to understand.

Example refactoring structure:

private filterItemsBySearch(items: SidebarCardElement[]): SidebarCardElement[] {
    // Search filtering logic
}

private shouldApplyGrouping(filteredItems: SidebarCardElement[], groupKey: string): boolean {
    // Logic to determine if grouping should be applied
}

private createWeekGroups(filteredItems: SidebarCardElement[]): Map<string, SidebarCardElement[]> {
    // Logic to create week groups
}

private sortWeekGroups(weekGroups: Map<string, SidebarCardElement[]>): WeekGroup[] {
    // Logic to sort and format week groups
}

getGroupedByWeek(groupKey: string): WeekGroup[] {
    const items = this.groupedData[groupKey].entityData;
    const filteredItems = this.filterItemsBySearch(items);
    
    if (!this.shouldApplyGrouping(filteredItems, groupKey)) {
        return [{ weekRange: '', items: filteredItems }];
    }
    
    const weekGroups = this.createWeekGroups(filteredItems);
    return this.sortWeekGroups(weekGroups);
}

119-121: Consider using the SearchFilterPipe instead of manual filtering.

Since you're already importing SearchFilterPipe, consider leveraging it for consistency instead of implementing the search filter logic manually in this method.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 829cfdb and e95cace.

📒 Files selected for processing (1)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`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:PascalC...

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/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts
🧬 Code Definitions (1)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (1)
src/main/webapp/app/shared/types/sidebar.ts (1)
  • SidebarCardElement (48-165)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-tests
  • GitHub Check: server-tests
  • GitHub Check: Build .war artifact
  • GitHub Check: Build and Push Docker Image / Build Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build Docker Image for ls1intum/artemis
  • GitHub Check: Analyse
🔇 Additional comments (5)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (5)

11-14: Correct usage of dayjs library and plugin.

The import of the dayjs library and the isoWeek plugin is appropriate for handling date-based weekly grouping operations. The plugin extension is properly set up before usage.


16-19: Clean interface definition for week grouping.

The WeekGroup interface is well-structured with clear property definitions, making the code more maintainable and type-safe.


21-21: Good use of constant for grouping threshold.

Setting a clear constant for the minimum number of items required for grouping makes the code more maintainable and aligns with the PR objective of only grouping when necessary.


108-113: Well-implemented date formatting for week ranges.

The getWeekKey method correctly calculates the ISO week boundaries and formats them appropriately for display.


167-185:

✅ Verification successful

Verify sort order assumptions with test cases.

The sorting logic makes assumptions about date formatting and processing. Ensure comprehensive test cases cover different date scenarios to verify the correct ordering of week groups.


🏁 Script executed:

#!/bin/bash
# Check for test cases that verify week sorting logic
rg -A 3 "getGroupedByWeek" "src/test/javascript/spec"

Length of output: 2765


Action: Sorting logic verified – tests confirm expected behavior

The existing test cases in
src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts
adequately exercise the sorting logic. They verify that:

  • Entries with a week range of "No Date" sort to the end.
  • Comparisons based on year extraction and date parsing work as expected.

If there’s any concern about additional edge cases (e.g., unexpected date formats or missing week range values), consider expanding the tests, but current tests address the main assumptions.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 30, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de March 30, 2025 20:05 Inactive
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report202 ran195 passed3 skipped4 failed1h 2m 54s 296ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/exam/ExamParticipation.spec.ts
ts.Exam participation › Programming exam with Git submissions › Participates in exam by Git submission using ssh❌ failure5m 6s 334ms
e2e/exercise/programming/ProgrammingExerciseParticipation.spec.ts
ts.Programming exercise participation › Programming exercise participation using secure git › Programming exercise participation using SSH › Makes a git submission using SSH with RSA key❌ failure4m 46s 700ms
ts.Programming exercise participation › Programming exercise participation using secure git › Programming exercise participation using SSH › Makes a git submission using SSH with ED25519 key❌ failure4m 44s 881ms
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure1m 44s 440ms

asliayk
asliayk previously approved these changes Mar 30, 2025
Copy link
Contributor

@asliayk asliayk left a comment

Choose a reason for hiding this comment

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

tested locally and works as expected 🚀

@helios-staging-aet helios-staging-aet bot temporarily deployed to artemis-test7.artemis.cit.tum.de March 31, 2025 02:30 Inactive
@eylulnc eylulnc dismissed stale reviews from PaRangger, asliayk, and HawKhiem via 8c140ec April 21, 2025 20:20
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 21, 2025
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran197 passed3 skipped1 failed51m 20s 895ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to edit message in channel❌ failure2m 3s 165ms

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 21, 2025
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran195 passed3 skipped3 failed51m 13s 242ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to edit message in channel❌ failure2m 2s 808ms
e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts
ts.Quiz Exercise Participation › DnD Quiz participation › Student can participate in DnD Quiz❌ failure2m 2s 374ms
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure1m 44s 716ms

Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran196 passed3 skipped2 failed50m 6s 745ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to edit message in channel❌ failure2m 3s 179ms
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure1m 45s 671ms

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de April 21, 2025 23:53 Inactive
@eylulnc eylulnc requested a review from krusche April 21, 2025 23:55
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran196 passed3 skipped2 failed50m 31s 117ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to edit message in channel❌ failure2m 3s 17ms
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure1m 43s 895ms

@helios-aet helios-aet bot temporarily deployed to artemis-test5.artemis.cit.tum.de April 22, 2025 17:11 Inactive
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran197 passed3 skipped1 failed43m 20s 870ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to edit message in channel❌ failure2m 3s 557ms

Copy link
Contributor

@tobias-lippert tobias-lippert left a comment

Choose a reason for hiding this comment

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

code

@helios-aet helios-aet bot temporarily deployed to artemis-test5.artemis.cit.tum.de April 23, 2025 08:29 Inactive
Copy link
Contributor

@PaRangger PaRangger left a comment

Choose a reason for hiding this comment

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

Re-tested on TS5, everything still works as described. ✅

Copy link
Contributor

@asliayk asliayk left a comment

Choose a reason for hiding this comment

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

retested on ts5

Copy link
Contributor

@FelberMartin FelberMartin left a comment

Choose a reason for hiding this comment

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

code

@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de April 24, 2025 07:50 Inactive
Copy link
Contributor

@julian-wls julian-wls 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 TS2, works as expected!

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de April 25, 2025 20:53 Inactive
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.

Retested on TS3. Reapprove

Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

code

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!) core Pull requests that affect the corresponding module ready for review ready to merge
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.