Repository: ls1intum/Artemis
Pull request #10804: `Communication`: Update posting groups in-place
Author: login: eylulnc
Labels: name: ready for review
name: client
description: Pull requests that update TypeScript code. (Added Automatically!)
name: small
name: bugfix
name: ready to merge
name: communication
description: Pull requests that affect the corresponding module
Created: 2025-05-06T23:34:26Z | Merged: 2025-05-10T19:55:32Z

<!-- Thanks for contributing to Artemis! Before you submit your pull request, please make sure to check all tasks by putting an x in the [ ] (don't: [x ], [ x], do: [x]). Remove not applicable tasks and do not leave them unchecked -->
<!-- If your pull request is not ready for review yet, create a draft pull request! -->

### Checklist
#### General
<!-- Remove tasks that are not applicable for your PR. Please only put the PR into ready for review, if all relevant tasks are checked! -->
<!-- You only need to choose one of the first two check items: Generally, test on the test servers. -->
<!-- If it's only a small change, testing it locally is acceptable, and you may remove the first checkmark. If you are unsure, please test on the test servers. -->
- [x] This is a small issue that I tested locally and was confirmed by another developer on a test server.
- [x] Language: I followed the [guidelines for inclusive, diversity-sensitive, and appreciative language](https://docs.artemis.cit.tum.de/dev/guidelines/language-guidelines/).
- [x] I chose a title conforming to the [naming conventions for pull requests](https://docs.artemis.cit.tum.de/dev/development-process/development-process.html#naming-conventions-for-github-pull-requests).

#### Client
- [x] I **strictly** followed the [client coding and design guidelines](https://docs.artemis.cit.tum.de/dev/guidelines/client/).

### Motivation and Context
When deleting multiple messages consecutively in the Communication tab, all messages disappeared at the same time or shortly after the Undo timer of the first deleted message ran out. [The issue mentioned here also](https://github.com/ls1intum/Artemis/issues/10246).
This behavior was incorrect because each message should be deleted only after its own timer expires.

### Description
<!-- Describe your changes in detail -->
This PR optimizes the post grouping logic by updating post groups in place whenever possible.  
Instead of always recreating all groups, we now update the existing groups if the structure remains compatible.  
This improves performance and reduces unnecessary component destruction and re-creation.

### Steps for Testing
<!-- Please describe in detail how reviewers can test your changes. Make sure to take all related features and views into account! Below is an example that you can refine. -->
Prerequisites:
- 1 Instructor

1. Log in to Artemis
2. Navigate to Course Communication
3. Write at least 2 messages
4. Delete both with a small delay in between the deletions
5. Find the postings to be deleted consecutively and not at once
6. Verify everything works as expected with message grouping

### Testserver States
You can manage test servers using [Helios](https://helios.aet.cit.tum.de/). Check environment statuses in the [environment list](https://helios.aet.cit.tum.de/repo/69562331/environment/list). To deploy to a test server, go to the [CI/CD](https://helios.aet.cit.tum.de/repo/69562331/ci-cd) page, find your PR or branch, and trigger the deployment.

### Review Progress
#### Code Review
- [x] Code Review 1
- [x] Code Review 2
#### Manual Tests
- [x] Test 1
- [x] Test 2

### Test Coverage

| Class/File | Line Coverage | Confirmation (assert/expect) |
|------------|--------------:|-----------------------------:|
| conversation-messages.component.ts | 94.46% | ✅ ❌ |


### Screenshots
https://github.com/user-attachments/assets/968e1d3e-985d-4048-b1d7-a9451c5bdfaa



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
  - Improved the grouping of consecutive messages by author and time, ensuring more accurate display of message groups.
  - Enhanced incremental updates for message groups, resulting in smoother updates when new messages arrive.
- **Refactor**
  - Optimized the logic for grouping messages, leading to better performance and maintainability.
- **Tests**
  - Added new tests to verify correct grouping of messages by author and update behavior after message deletions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts b/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts
index dbc2dab8675d..af5c61ee30df 100644
--- a/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts
+++ b/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts
@@ -527,5 +527,63 @@ examples.forEach((activeConversation) => {
             expect(component.pinnedPosts).toEqual(pinnedPostsStub);
             expect(pinnedCountSpy).toHaveBeenCalledWith(pinnedPostsStub.length);
         }));
+
+        it('should group posts correctly with consecutive messages from same author', () => {
+            const posts = [
+                { id: 1, creationDate: dayjs(), author: { id: 1 } } as Post,
+                { id: 2, creationDate: dayjs().add(1, 'minute'), author: { id: 1 } } as Post,
+                { id: 3, creationDate: dayjs().add(2, 'minutes'), author: { id: 1 } } as Post,
+            ];
+
+            component.posts = posts;
+            (component as any).groupPosts();
+
+            expect(component.groupedPosts).toHaveLength(1);
+            expect(component.groupedPosts[0].posts).toHaveLength(3);
+            expect(component.groupedPosts[0].posts[0].isConsecutive).toBeFalse();
+            expect(component.groupedPosts[0].posts[1].isConsecutive).toBeTrue();
+            expect(component.groupedPosts[0].posts[2].isConsecutive).toBeTrue();
+        });
+
+        it('should group posts correctly with different authors', () => {
+            const posts = [
+                { id: 1, creationDate: dayjs(), author: { id: 1 } } as Post,
+                { id: 2, creationDate: dayjs().add(1, 'minute'), author: { id: 2 } } as Post,
+                { id: 3, creationDate: dayjs().add(2, 'minutes'), author: { id: 1 } } as Post,
+            ];
+
+            component.posts = posts;
+            (component as any).groupPosts();
+
+            expect(component.groupedPosts).toHaveLength(3);
+            expect(component.groupedPosts[0].posts).toHaveLength(1);
+            expect(component.groupedPosts[1].posts).toHaveLength(1);
+            expect(component.groupedPosts[2].posts).toHaveLength(1);
+        });
+
+        it('should handle multiple message deletions correctly', () => {
+            // Initial posts
+            const initialPosts = [
+                { id: 1, creationDate: dayjs(), author: { id: 1 } } as Post,
+                { id: 2, creationDate: dayjs().add(1, 'minute'), author: { id: 1 } } as Post,
+                { id: 3, creationDate: dayjs().add(2, 'minutes'), author: { id: 2 } } as Post,
+                { id: 4, creationDate: dayjs().add(3, 'minutes'), author: { id: 2 } } as Post,
+            ];
+
+            component.posts = initialPosts;
+            (component as any).groupPosts();
+
+            // Delete posts 2 and 3
+            const postsAfterDeletion = [{ id: 1, creationDate: dayjs(), author: { id: 1 } } as Post, { id: 4, creationDate: dayjs().add(3, 'minutes'), author: { id: 2 } } as Post];
+
+            component.posts = postsAfterDeletion;
+            (component as any).groupPosts();
+
+            expect(component.groupedPosts).toHaveLength(2);
+            expect(component.groupedPosts[0].posts).toHaveLength(1);
+            expect(component.groupedPosts[1].posts).toHaveLength(1);
+            expect(component.groupedPosts[0].author?.id).toBe(1);
+            expect(component.groupedPosts[1].author?.id).toBe(2);
+        });
     });
 });
diff --git a/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts b/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts
index 69f7b288bcde..6a20f2f45550 100644
--- a/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts
+++ b/src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts
@@ -288,47 +288,75 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
     }
 
     private groupPosts(): void {
+        // If there are no posts, clear groupedPosts and exit.
         if (!this.posts || this.posts.length === 0) {
             this.groupedPosts = [];
             return;
         }
 
-        const sortedPosts = this.posts.sort((a, b) => {
+        // Sort posts by the creation date
+        const sortedPosts = [...this.posts].sort((a, b) => {
             return a.creationDate!.valueOf() - b.creationDate!.valueOf();
         });
 
-        const groups: PostGroup[] = [];
-        let currentGroup: PostGroup = {
-            author: sortedPosts[0].author,
-            posts: [{ ...sortedPosts[0], isConsecutive: false }],
-        };
+        // Compute new grouping based on current posts.
+        const computedGroups: PostGroup[] = [];
+        let currentGroup: PostGroup | undefined = undefined;
+
+        sortedPosts.forEach((post) => {
+            if (!currentGroup) {
+                // Start new group if none exists.
+                currentGroup = { author: post.author, posts: [{ ...post, isConsecutive: false }] };
+                return;
+            }
 
-        for (let i = 1; i < sortedPosts.length; i++) {
-            const currentPost = sortedPosts[i];
-            const lastPostInGroup = currentGroup.posts[currentGroup.posts.length - 1];
+            const lastPost = currentGroup.posts[currentGroup.posts.length - 1];
+            const currentDate = post.creationDate;
+            const lastDate = lastPost.creationDate;
 
             let timeDiff = Number.MAX_SAFE_INTEGER;
-            if (currentPost.creationDate && lastPostInGroup.creationDate) {
-                timeDiff = currentPost.creationDate.diff(lastPostInGroup.creationDate, 'minute');
+            if (currentDate && lastDate) {
+                timeDiff = currentDate.diff(lastDate, 'minute');
             }
 
-            if (currentPost.author?.id === currentGroup.author?.id && timeDiff < 5 && timeDiff >= 0) {
-                currentGroup.posts.push({ ...currentPost, isConsecutive: true }); // consecutive post
+            if (this.isAuthorEqual(currentGroup, { author: post.author, posts: [] }) && timeDiff < 5 && timeDiff >= 0) {
+                currentGroup.posts.push({ ...post, isConsecutive: true });
             } else {
-                groups.push(currentGroup);
-                currentGroup = {
-                    author: currentPost.author,
-                    posts: [{ ...currentPost, isConsecutive: false }],
-                };
+                computedGroups.push(currentGroup);
+                currentGroup = { author: post.author, posts: [{ ...post, isConsecutive: false }] };
             }
+        });
+        if (currentGroup) {
+            computedGroups.push(currentGroup);
         }
 
-        groups.push(currentGroup);
+        // Update existing groups in place if possible.
+        if (this.groupedPosts.length === computedGroups.length) {
+            computedGroups.forEach((g, i) => {
+                if (this.groupedPosts[i].author?.id === g.author?.id) {
+                    // If the group belongs to the same author, update its posts array in place.
+                    this.groupedPosts[i].posts.splice(0, this.groupedPosts[i].posts.length, ...g.posts);
+                } else {
+                    // If group identity has changed, replace the group.
+                    this.groupedPosts[i] = g;
+                }
+            });
+        } else {
+            this.groupedPosts = computedGroups;
+        }
 
-        this.groupedPosts = groups;
+        // Trigger Angular change detection.
         this.cdr.detectChanges();
     }
 
+    private isAuthorEqual(groupA: PostGroup, groupB: PostGroup): boolean {
+        // Both groups are equal if neither has an author; otherwise, they are not
+        if (!groupA.author || !groupB.author) {
+            return !groupA.author && !groupB.author;
+        }
+        return groupA.author.id === groupB.author.id;
+    }
+
     setPosts(): void {
         if (this.content) {
             this.previousScrollDistanceFromTop = this.content.nativeElement.scrollHeight - this.content.nativeElement.scrollTop;
@@ -426,10 +454,9 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
                     this.groupPosts();
                 }
             });
-        } else {
-            // No posts with forwarded messages
-            this.groupPosts();
         }
+        // Incrementally update the grouped posts.
+        this.groupPosts();
     }
 
     fetchNextPage() {


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>🧹 Nitpick comments (2)</summary><blockquote>

<details>
<summary>src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts (2)</summary><blockquote>

`465-467`: **Redundant invocation of `groupPosts()`**  

`groupPosts()` is already called inside every branch of the forwarded-message fetch above.  
Calling it once more here means:

1. It runs immediately **before** forwarded messages are attached ⇒ produces incomplete groups that will be discarded later.
2. It triggers an extra `detectChanges` cycle, which is avoidable.

Suggestion: remove this second call and rely solely on the calls after the asynchronous enrichment finishes.

---

`359-365`: **Minor naming nit – use plural in helper method**  

`isAuthorEqual` compares *two* authors; pluralising conveys intent more clearly and reads better:

```diff
-private isAuthorEqual(groupA: PostGroup, groupB: PostGroup): boolean {
+private areAuthorsEqual(groupA: PostGroup, groupB: PostGroup): boolean {
```

(remember to update the call sites).

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

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

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 0f038cf76e28759c5482ebe8feab52b2679c2471 and 2b0656f78e50c9c234bb346ec53d15667bdeb77e.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts` (2 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>📓 Path-based instructions (1)</summary>

<details>
<summary>`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...</summary>

> `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/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts`

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: Codacy Static Code Analysis

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts (1)</summary>

`340-353`: _🛠️ Refactor suggestion_

**`groupedPosts` re-ordering is not handled**  

The in-place update assumes the **index** of each author-group is stable.  
When a new post is inserted at the top or a group disappears, the number of groups can still match, yet their order is off (e.g. `[A,B]` ➜ `[B,A]`). The current logic merely updates the posts but leaves the order untouched, resulting in groups shown in the wrong sequence.

Consider re-synchronising the array when either  
1. any group’s first post id differs, or  
2. the author order differs.

Simplest fix – replace the array whenever the content order changes:

```diff
-if (this.groupedPosts.length === computedGroups.length) {
-    …
-} else {
-    this.groupedPosts = computedGroups;
-}
+const isSameOrder =
+    this.groupedPosts.length === computedGroups.length &&
+    this.groupedPosts.every((g, i) => g.author?.id === computedGroups[i].author?.id);
+
+if (isSameOrder) {
+    … // current in-place update logic
+} else {
+    // keeps change detection cheap but guarantees correct order
+    this.groupedPosts.splice(0, this.groupedPosts.length, ...computedGroups);
+}
```




> Likely an incorrect or invalid review comment.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T01:28:57Z
user: login: coderabbitai[bot]
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T01:37:24Z
user: login: PaRangger
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T08:23:52Z
user: login: HawKhiem
body: Tested on TS1. Works as expected
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T08:37:09Z
user: login: coderabbitai[bot]
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T08:50:27Z
user: login: PaRangger
body: Thanks for adding the feedback! Tested on TS5/TS2, code LGTM ✅ 
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T09:06:05Z
user: login: HawKhiem
body: Retested on TS3. Reapprove
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T12:29:50Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (4)</summary><blockquote>

<details>
<summary>src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts (4)</summary><blockquote>

`322-324`: **Consider extracting the 5-minute threshold to a constant**

The 5-minute threshold for grouping consecutive messages appears to be a business rule that might need adjustment in the future.

```diff
+    private readonly CONSECUTIVE_MESSAGE_THRESHOLD_MINUTES = 5;
     // ...
-    if (this.isAuthorEqual(currentGroup, { author: post.author, posts: [] }) && timeDiff < 5 && timeDiff >= 0) {
+    if (this.isAuthorEqual(currentGroup, { author: post.author, posts: [] }) && timeDiff < this.CONSECUTIVE_MESSAGE_THRESHOLD_MINUTES && timeDiff >= 0) {
```

---

`338-338`: **Consider if splice is the best approach here**

Using `splice(0, length, ...items)` to replace array contents works but is less readable than alternatives.

```diff
-    this.groupedPosts[i].posts.splice(0, this.groupedPosts[i].posts.length, ...g.posts);
+    this.groupedPosts[i].posts = [...g.posts];
```

---

`319-319`: **Consider using a more precise time comparison method**

Using `diff` with 'minute' granularity might lead to edge cases. Consider using milliseconds for more precise comparisons.

```diff
-    timeDiff = currentDate.diff(lastDate, 'minute');
+    timeDiff = currentDate.diff(lastDate, 'millisecond') / 60000; // Convert ms to minutes
```

---

`354-355`: **Simplify boolean expression**

The boolean expression can be simplified for better readability.

```diff
-    if (!groupA.author || !groupB.author) {
-        return !groupA.author && !groupB.author;
-    }
+    // Both authors must be defined to proceed with ID comparison
+    if (!groupA.author || !groupB.author) {
+        return groupA.author === groupB.author; // true only when both are null/undefined
+    }
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

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

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 750f7d21a7d0c41529f860f753803ee396a12a50 and 74e5c20b6ec2ff2a420ec064b068a2ad2d8e5bc4.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts` (2 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>📓 Path-based instructions (1)</summary>

<details>
<summary>`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...</summary>

> `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/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts`

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (10)</summary>

* GitHub Check: Codacy Static Code Analysis
* 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: Build .war artifact
* GitHub Check: client-style
* GitHub Check: client-tests
* GitHub Check: client-tests-selected
* GitHub Check: server-style
* GitHub Check: server-tests
* GitHub Check: Analyse

</details>

<details>
<summary>🔇 Additional comments (6)</summary><blockquote>

<details>
<summary>src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts (6)</summary>

`291-295`: **Good defensive programming!**

Adding an early return pattern for the empty posts case improves code clarity and efficiency.

---

`297-300`: **Good use of spread operator to avoid mutations!**

Creating a copy of the array before sorting prevents unintended side effects on the original `this.posts` array.

---

`302-331`: **Clean and logical group creation approach**

The rewritten grouping algorithm uses a clear `forEach` approach with well-defined conditional logic. The handling of consecutive posts is now more explicit and easier to follow.

---

`333-346`: **Great optimization for incremental updates!**

This is the core improvement that resolves the deletion issue. By updating existing groups in place whenever possible instead of recreating them, component destruction and re-creation is minimized. This explains why messages now delete independently rather than all at once.

---

`352-358`: **Clean helper method for author comparison**

Extracting the author comparison logic into a dedicated method improves code maintainability and handles edge cases safely.

---

`458-459`: **Ensures consistent grouping behavior**

Always calling `groupPosts()` at the end of `setPosts()` ensures consistent behavior regardless of the presence of forwarded messages.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T12:42:20Z
user: login: badkeyy
body: Tested on TS1 works as expected. Thanks for completing this issue I had no time to finish it myself in my previous PR.
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T20:35:19Z
user: login: cremertim
body: Code look good to me
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T13:19:23Z
user: login: cremertim
body: Code lgtm, but the client tests are not passing. Realized this one to late. Your coverage is to low
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T13:29:18Z
user: login: coderabbitai[bot]
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T14:00:41Z
user: login: cremertim
body: Thank you very much for adding the test cases. Everything looks good for me know 👍 

state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T14:08:46Z
user: login: HawKhiem
body: Reapprove
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T14:12:31Z
user: login: badkeyy
body: Tests lgtm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T14:13:55Z
user: login: badkeyy
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T14:14:15Z
user: login: FelberMartin
body: Code lgtm
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T15:15:20Z
user: login: julian-wls
body: Tested on TS2, works as expected :+1: 
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T17:41:05Z
user: login: krusche
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-10T19:54:46Z

Review comments:
diff_hunk: @@ -295,47 +295,75 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
     }
 
     private groupPosts(): void {
+        // If there are no posts, clear groupedPosts and exit.
         if (!this.posts || this.posts.length === 0) {
             this.groupedPosts = [];
             return;
         }
 
+        // Sort posts by the creation date
         const sortedPosts = this.posts.sort((a, b) => {
             return a.creationDate!.valueOf() - b.creationDate!.valueOf();
         });
 
path: src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Avoid mutating `this.posts` while sorting**  

`Array.prototype.sort` sorts in-place. Because `this.posts` is reused later (e.g. for paging, scrolling calculations, re-grouping), any unexpected side-effects may surface – especially if another consumer relies on the reversed order you set a few lines above (`this.posts = this.posts.slice().reverse();`).  
Clone the array first so the original reference/order is preserved.

```diff
-const sortedPosts = this.posts.sort((a, b) => {
+const sortedPosts = [...this.posts].sort((a, b) => {
     return a.creationDate!.valueOf() - b.creationDate!.valueOf();
 });
```



<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **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.

`````suggestion
        // Sort posts by the creation date
        const sortedPosts = [...this.posts].sort((a, b) => {
            return a.creationDate!.valueOf() - b.creationDate!.valueOf();
        });
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts around lines 304 to 308, the sorting operation mutates the original this.posts array because Array.prototype.sort sorts in-place. To avoid side effects on this.posts used elsewhere, create a shallow copy of this.posts before sorting by using slice() or spread syntax, then sort the copied array. This preserves the original array order and prevents unexpected behavior.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit 02a68f1
created_at: 2025-05-07T01:28:56Z
author_association: CONTRIBUTOR
diff_hunk: @@ -295,47 +295,75 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
     }
 
     private groupPosts(): void {
+        // If there are no posts, clear groupedPosts and exit.
         if (!this.posts || this.posts.length === 0) {
             this.groupedPosts = [];
             return;
         }
 
-        const sortedPosts = this.posts.sort((a, b) => {
+        // Sort posts by the creation date
+        const sortedPosts = [...this.posts].sort((a, b) => {
             return a.creationDate!.valueOf() - b.creationDate!.valueOf();
         });
 
-        const groups: PostGroup[] = [];
-        let currentGroup: PostGroup = {
-            author: sortedPosts[0].author,
-            posts: [{ ...sortedPosts[0], isConsecutive: false }],
-        };
+        // Compute new grouping based on current posts.
+        const computedGroups: PostGroup[] = [];
+        let currentGroup: PostGroup | null = null;
path: src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts
user: login: PaRangger
body: We should use `undefined` here.
created_at: 2025-05-07T08:23:51Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-05-07T00:08:03Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ✅</th><th>Skipped</th><th>Failed</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>1 ran</td><td>1 passed</td><td>0 skipped</td><td>0 failed</td><td>1s 763ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3">No test annotations available</td></tr></table>
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-07T00:38:47Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ☑️</th><th>Skipped ⚠️</th><th>Failed ❌️</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>197 passed</td><td>3 skipped</td><td>1 failed</td><td>53m 38s 541ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3"><strong>End-to-End (E2E) Test Report</strong></td></tr><tr><td colspan="3"><em>e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts</em></td></tr><tr><td>ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors</td><td>❌ failure</td><td>1m 46s 856ms</td></tr></table>
author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-05-07T01:28:53Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

"""
## Walkthrough

The `groupPosts` method in the conversation messages component was refactored for clarity and improved incremental updates. The grouping now sorts posts by creation date, uses a new author comparison helper, and updates the grouped posts array in place when possible. The `setPosts` method always triggers grouping after processing forwarded messages. The test suite was extended with cases verifying grouping behavior and updates after deletions.

## Changes

| File(s)                                                                                                     | Change Summary                                                                                                                                                                                                                                  |
|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.ts | Refactored `groupPosts` for clearer logic, early exit on empty posts, sorting, and incremental updates; added `isAuthorEqual` helper; modified `setPosts` to always call grouping after processing forwarded messages.                          |
| src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts | Added three new tests verifying grouping of consecutive posts by the same author, grouping separation by different authors, and correct grouping updates after message deletions.                                                                |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant ConversationMessagesComponent

    User->>ConversationMessagesComponent: setPosts(posts)
    ConversationMessagesComponent->>ConversationMessagesComponent: Process forwarded messages
    ConversationMessagesComponent->>ConversationMessagesComponent: groupPosts()
    ConversationMessagesComponent->>ConversationMessagesComponent: Sort posts by creation date
    ConversationMessagesComponent->>ConversationMessagesComponent: Group posts by author and time threshold
    ConversationMessagesComponent->>ConversationMessagesComponent: Update groupedPosts (incremental if possible)
    ConversationMessagesComponent->>ConversationMessagesComponent: Trigger Angular change detection
```

## Suggested labels

`bugfix`

## Suggested reviewers

- PaRangger
- krusche
"""

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>⚡️ Faster reviews with caching</summary>
> 
> - CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure `Review - Disable Cache` at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the `Data Retention` setting under your Organization Settings.
> 
> Enjoy the performance boost—your workflow just got faster.
> 
> </details>

<!-- announcements_end -->

---

<details>
<summary>📜 Recent review details</summary>

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

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 74e5c20b6ec2ff2a420ec064b068a2ad2d8e5bc4 and fd33d34ef8113ddca761757708640c006f088b9c.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>📓 Path-based instructions (1)</summary>

<details>
<summary>`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...</summary>

> `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/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts`

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (5)</summary>

* 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: client-tests
* GitHub Check: server-tests
* GitHub Check: Analyse

</details>

<details>
<summary>🔇 Additional comments (3)</summary><blockquote>

<details>
<summary>src/main/webapp/app/communication/course-conversations-components/layout/conversation-messages/conversation-messages.component.spec.ts (3)</summary>

`531-546`: **Well-structured test for consecutive message grouping.**

The test verifies that posts from the same author within a time window are correctly grouped with appropriate isConsecutive flags.

---

`548-562`: **Good coverage of multi-author grouping logic.**

This test effectively verifies that posts from different authors are correctly separated into distinct groups regardless of timing.

---

`564-587`: **Excellent test addressing the core PR issue.**

This test directly addresses the PR's main objective of correctly handling multiple message deletions. It verifies that when messages are deleted, the grouping structure is properly maintained and updated, preventing the issue where all messages would disappear simultaneously after deletion.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAAwBhFmZsDHgGanh8DFiuAFVuWmoPbnxEcQwiSCIKfGxuZHgMMG4vNAYSaMg5SGxESkgSWS9vDAZ0Wlp/RD7kTBRp4JQsXFgPAEEKGmZUFu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lQq4oAugvhhIBRlgTGCIogEgAArAsAtoE/NQrQAAtoHAtgXQuYtYpRngUAuQqAvgWgoskEpRjQFQrIrArPI/OIoAtgVAqgvgQEEQqguiTItgU/PgVEF/Lgt/KArQDItktoBAsRgEAYCQXEqgD2FoGgpQtgpIFYuopQtoHSAApRj4sRnwo4pEvAvgV/L2A4qAoEEgrMvMokuJWvNvPvNbhOlTloCvKxX0CAA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=ls1intum/Artemis&utm_content=10804):

- 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.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

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](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-05-07T02:15:17Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ✅</th><th>Skipped ⚠️</th><th>Failed</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>198 passed</td><td>3 skipped</td><td>0 failed</td><td>52m 36s 540ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3">No test annotations available</td></tr></table>
author_association: NONE
user: login: PaRangger
created_at: 2025-05-07T08:25:21Z
body: Hey! I tested on TS5 and everything works very well! Thank you for solving this issue. One thing I noticed that might be unrelated: All delete calls are being made twice, failing once with a 404. I don't know if that is related to the changes or has always been like that.

<img width="680" alt="Bildschirmfoto 2025-05-07 um 10 23 47" src="https://github.com/user-attachments/assets/68b48305-7d21-4122-be5e-d2e8520f9f4f" />
author_association: CONTRIBUTOR
user: login: eylulnc
created_at: 2025-05-07T08:41:20Z
body: > Hey! I tested on TS5 and everything works very well! Thank you for solving this issue. One thing I noticed that might be unrelated: All delete calls are being made twice, failing once with a 404. I don't know if that is related to the changes or has always been like that.
> 
> <img alt="Bildschirmfoto 2025-05-07 um 10 23 47" width="680" src="https://private-user-images.githubusercontent.com/48455539/441137189-68b48305-7d21-4122-be5e-d2e8520f9f4f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDY2MDc0ODEsIm5iZiI6MTc0NjYwNzE4MSwicGF0aCI6Ii80ODQ1NTUzOS80NDExMzcxODktNjhiNDgzMDUtN2QyMS00MTIyLWJlNWUtZDJlODUyMGY5ZjRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTA3VDA4Mzk0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThiYzdmMzJkMzM2NjA1NTMxNDkyNzc3OGY2YjRjYWRiMmEyY2Y0MWEyZjQwNjI2YzUxZTJjMDkzMTBmOWE3MTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PFp_UxUA9GQoA1Ns7_p2k_nXMcufxX4_xhbEKZRSASk">

<img width="584" alt="Screenshot 2025-05-07 at 10 35 35" src="https://github.com/user-attachments/assets/0510499b-9ecb-4feb-9ccd-51eb6b9b430b" />

I also see a observed similar behavior on a different test server but I am not sure if it has affect on it.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-05-07T09:31:53Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ☑️</th><th>Skipped ⚠️</th><th>Failed ❌️</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>197 passed</td><td>3 skipped</td><td>1 failed</td><td>57m 15s 673ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3"><strong>End-to-End (E2E) Test Report</strong></td></tr><tr><td colspan="3"><em>e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts</em></td></tr><tr><td>ts.Quiz Exercise Participation › DnD Quiz participation › Student can participate in DnD Quiz</td><td>❌ failure</td><td>2m 3s 915ms</td></tr></table>
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-07T19:06:29Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ✅</th><th>Skipped ⚠️</th><th>Failed</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>198 passed</td><td>3 skipped</td><td>0 failed</td><td>48m 2s 121ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3">No test annotations available</td></tr></table>
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-09T12:38:46Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ✅</th><th>Skipped ⚠️</th><th>Failed</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>198 passed</td><td>3 skipped</td><td>0 failed</td><td>47m 5s 752ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3">No test annotations available</td></tr></table>
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-09T14:34:08Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ☑️</th><th>Skipped ⚠️</th><th>Failed ❌️</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>197 passed</td><td>3 skipped</td><td>1 failed</td><td>55m 23s 934ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3"><strong>End-to-End (E2E) Test Report</strong></td></tr><tr><td colspan="3"><em>e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts</em></td></tr><tr><td>ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors</td><td>❌ failure</td><td>1m 52s 96ms</td></tr></table>
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-10T12:31:29Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ☑️</th><th>Skipped ⚠️</th><th>Failed ❌️</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>197 passed</td><td>3 skipped</td><td>1 failed</td><td>56m 34s 285ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3"><strong>End-to-End (E2E) Test Report</strong></td></tr><tr><td colspan="3"><em>e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts</em></td></tr><tr><td>ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors</td><td>❌ failure</td><td>1m 50s 355ms</td></tr></table>
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-10T13:56:07Z
body: ### End-to-End (E2E) Test Results Summary

<table><tr><th><th>Tests</th><th>Passed ☑️</th><th>Skipped ⚠️</th><th>Failed ❌️</th><th>Time ⏱</th></tr><tr><td>End-to-End (E2E) Test Report</td><td>201 ran</td><td>197 passed</td><td>3 skipped</td><td>1 failed</td><td>54m 10s 120ms</td></tr></table> <table><tr><th>Test</th><th>Result</th><th>Time ⏱</th></tr><tr><td colspan="3"><strong>End-to-End (E2E) Test Report</strong></td></tr><tr><td colspan="3"><em>e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts</em></td></tr><tr><td>ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors</td><td>❌ failure</td><td>1m 45s 926ms</td></tr></table>
author_association: NONE