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

Programming exercises: Add feedback discussion feature to feedback analysis table #9810

Conversation

az108
Copy link
Contributor

@az108 az108 commented Nov 17, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • 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 authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

This is a follow-up to the feature I’m working on: #9728. The goal is to provide instructors with clearer insights into the feedback given to students. In this PR, a “Feedback Discussion” modal has been introduced. This feature allows instructors to select specific feedback and open a communication channel for it, provided the course has one. For example, during an exam review, instructors can use this functionality to send messages that clarify certain mistakes, offering students a better understanding and clearer insights.

Description

A new server-side query has been implemented, which takes a feedbackDetailText input and creates a channel based on it, automatically adding all students who encountered the corresponding error. On the client side, instructors can now create these channels via a modal accessible on the far-right side of each feedback entry. This modal provides two options: instructors can either navigate directly to the newly created channel or remain on the feedback analysis page. Additionally, the modal allows instructors to specify the channel type, name, and description.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • Student Sumbissions
  • 1 Programming Exercise
  1. Log in to Artemis
  2. Navigate to a Course with Instructor rights
  3. Create a Programming Exercise or use an existing one
  4. Solve the Programming Exercise as Students, ideally with different kinds of Progress (You can use artemis test users for this)
  5. Navigate as Instructor to the Grading of an Exercise
  6. Navigate to the Feedback Analysis section
  7. Verify that the table displays data correctly, and press the icon in a feedback table entry on the far right side to see the feedback-channel modal
  8. Verify that the channel is created as specified and both creation methods work as intended. Also make sure that all affected students are added to the corresponding channel when creating it.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Class/File Line Coverage Confirmation (expect)
feedback-analysis 94.11%
feedback-analysis-modal 92.59%
Methods in ResultService 100%
Methods in ResultResource 100%
Methods in ChannelResource 100%

Screenshots

Before:
image

After:
image
image

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced functionality to count students affected by specific feedback details.
    • Added endpoints for creating feedback-specific channels and managing feedback discussions.
    • New modals for confirming feedback channel creation and managing feedback details.
  • Enhancements

    • Improved user interface with new labels and messages for feedback channels.
    • Enhanced feedback analysis component to support communication features.
    • Added success messages and confirmation modals for channel creation.
  • Bug Fixes

    • Various improvements to ensure robust error handling and user notifications.
  • Documentation

    • Updated translations and user guidance for new features.

az108 and others added 26 commits November 10, 2024 21:43
…g-exercises/add-affected-students-to-analysis-table
…d-affected-students-to-analysis-table' into feature/programming-exercises/add-affected-students-to-analysis-table
…d-affected-students-to-analysis-table' into feature/programming-exercises/add-affected-students-to-analysis-table
…g-exercises/add-communication-feature-to-analysis-table

# Conflicts:
#	src/main/java/de/tum/cit/aet/artemis/assessment/web/ResultResource.java
#	src/main/java/de/tum/cit/aet/artemis/exercise/repository/StudentParticipationRepository.java
#	src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.component.html
#	src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.component.ts
#	src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.service.ts
#	src/main/webapp/i18n/de/programmingExercise.json
#	src/main/webapp/i18n/en/programmingExercise.json
…g-exercises/add-communication-feature-to-analysis-table
@az108 az108 self-assigned this Nov 17, 2024
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels Nov 17, 2024
Copy link

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 26, 2024
@az108 az108 added deploy:artemis-test1 and removed deployment-error Added by deployment workflows if an error occured deploy:artemis-test1 labels Nov 26, 2024
Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

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

Re-approve code

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 (3)
src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.component.ts (3)

215-218: Consider using a dedicated interface for the request DTO.

The FeedbackChannelRequestDTO could be better structured by defining its properties in a dedicated interface rather than creating it inline.

-                const feedbackChannelRequest: FeedbackChannelRequestDTO = {
-                    channel: channelDto,
-                    feedbackDetailText: feedbackDetail.detailText,
-                };
+                const feedbackChannelRequest = FeedbackChannelRequestDTO.create({
+                    channel: channelDto,
+                    feedbackDetailText: feedbackDetail.detailText,
+                });

220-227: Add a delay before navigation to ensure visibility of success message.

The immediate navigation might prevent users from seeing the success message. Consider adding a small delay.

-                if (navigate) {
-                    const urlTree = this.router.createUrlTree(['courses', this.courseId(), 'communication'], {
-                        queryParams: { conversationId: createdChannel.id },
-                    });
-                    await this.router.navigateByUrl(urlTree);
-                }
+                if (navigate) {
+                    // Allow time for success message to be shown
+                    await new Promise(resolve => setTimeout(resolve, 1500));
+                    const urlTree = this.router.createUrlTree(['courses', this.courseId(), 'communication'], {
+                        queryParams: { conversationId: createdChannel.id },
+                    });
+                    await this.router.navigateByUrl(urlTree);
+                }

234-236: Document the empty catch block.

While it's valid to ignore modal dismissal, it's good practice to document this intention.

         } catch {
-            // modal dismissed
+            // Intentionally empty: modal dismissal is an expected user action
         } finally {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4847f02 and 4d47d71.

📒 Files selected for processing (1)
  • src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.component.ts (7 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.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 (3)
src/main/webapp/app/exercises/programming/manage/grading/feedback-analysis/feedback-analysis.component.ts (3)

2-2: LGTM! Clean implementation of new imports and properties.

The new imports and properties are well-organized and follow Angular's style guide. The modal state management flag is a good practice to prevent multiple instances.

Also applies to: 5-6, 15-17, 30-31, 71-72


228-230: 🛠️ Refactor suggestion

Enhance error handling with specific error messages.

The current error handling could be more specific to provide better user feedback.


205-239: Verify potential sensitive information leakage.

Based on the PR objectives, there were concerns about sensitive information being exposed through channel names. Ensure that the channel creation process includes appropriate warnings or validations.

✅ Verification successful

Let me search for channel-related validation and warnings in the codebase.


Let me search for channel name validation in the feedback channel creation modal.


Based on the search results, I can now provide a final response:

Channel name validation is properly implemented with appropriate restrictions.

The codebase includes several safeguards for channel names:

  • Channel names must match the regex pattern ^[a-z0-9-]{1}[a-z0-9-]{0,30}$, which only allows lowercase letters, numbers, and hyphens
  • Maximum length is enforced to 20 characters
  • Channel names are required and cannot be empty
  • Channel creation form includes validation with appropriate error messages
  • Channel names are automatically formatted to remove special characters and convert to lowercase

The implementation in channel-form.component.ts and its usage in the feedback channel creation modal provides sufficient protection against sensitive information being exposed through channel names.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential sensitive information handling in channel-related code

# Look for any existing warning messages or validation
rg -l "warning|sensitive|private" --type ts

# Check for test case visibility handling
ast-grep --pattern 'visibility === "NEVER" || visibility === "AFTER_DUE_DATE"'

Length of output: 94414


Script:

#!/bin/bash
# Search for channel creation validation and warnings in relevant files
rg -A 5 "createChannel|channelDto|FeedbackDetailChannelModal" --type ts

# Search for any warning messages in channel creation
rg -A 5 "warning.*channel|channel.*warning" --type ts

# Look for channel name validation
rg -A 5 "channel.*name.*validation|validateChannel|channelName" --type ts

Length of output: 102741


Script:

#!/bin/bash
# Look for channel name validation in feedback channel modal
rg -A 10 "FeedbackDetailChannelModal" --type ts

# Look for channel name validation patterns
rg -A 5 "channelRegex|channel.*pattern|channel.*validation" --type ts

Length of output: 28406

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.

re-approve

Copy link
Contributor

@MarkusPaulsen MarkusPaulsen left a comment

Choose a reason for hiding this comment

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

  1. The code looks good
  2. I tested the PR on TS1, where I created an exercise, throwing a custom error message. Subsequently, I made a channel on the Feedback Analysis page to address this error message
  3. The aforementioned incorrect message does not appear anymore.

@MarkusPaulsen MarkusPaulsen added the maintainer-approved The feature maintainer has approved the PR label Nov 26, 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: 0

🧹 Outside diff range and nitpick comments (2)
src/main/java/de/tum/cit/aet/artemis/exercise/repository/StudentParticipationRepository.java (2)

1391-1412: Consider adding parameter validation.

The implementation is well-optimized with INNER JOINs and properly filters for the latest results. However, consider adding @NotNull annotations for the parameters to ensure they are validated at compile time.

-    List<String> findAffectedLoginsByFeedbackDetailText(@Param("exerciseId") long exerciseId, @Param("detailText") String detailText);
+    List<String> findAffectedLoginsByFeedbackDetailText(@Param("exerciseId") @NotNull long exerciseId, @Param("detailText") @NotNull String detailText);

1414-1439: Consider adding parameter validation.

The implementation is well-optimized and consistent with findAffectedLoginsByFeedbackDetailText. Consider adding @NotNull annotations for the parameters to ensure they are validated at compile time.

-    long countAffectedStudentsByFeedbackDetailText(@Param("exerciseId") long exerciseId, @Param("detailText") String detailText);
+    long countAffectedStudentsByFeedbackDetailText(@Param("exerciseId") @NotNull long exerciseId, @Param("detailText") @NotNull String detailText);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4d47d71 and 293b967.

📒 Files selected for processing (1)
  • src/main/java/de/tum/cit/aet/artemis/exercise/repository/StudentParticipationRepository.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/exercise/repository/StudentParticipationRepository.java (1)

Pattern src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

@krusche krusche merged commit 4eb3fe9 into develop Nov 26, 2024
34 of 38 checks passed
@krusche krusche deleted the feature/programming-exercises/add-communication-feature-to-analysis-table branch November 26, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assessment Pull requests that affect the corresponding module client Pull requests that update TypeScript code. (Added Automatically!) communication Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module maintainer-approved The feature maintainer has approved the PR ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.