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

Athena: Add badge to display remaining AI feedback requests #10234

Merged
merged 13 commits into from
Feb 2, 2025

Conversation

ahmetsenturk
Copy link
Contributor

@ahmetsenturk ahmetsenturk commented Jan 30, 2025

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Currently, students can request feedback from AI 10 times. However, they only learn about this when they send the 11th request. Therefore, there was a need to let them know about this through UI.

Description

A badge was added to the request feedback button, which displays how many requests students can send.

Additionally, it removes unused, leftover code in ProgrammingExerciseCodeReviewFeedbackService.java.

Steps for Testing

Prerequisites:

  • Has to be deployed on TS1, TS2, or TS3 as only there Athena is enabled
  • 1 Instructor
  • 2 Students
  • 1 (Text, Programming, or Modeling) Exercise with Athena Feedback Requests enabled
  1. Start the exercise
  2. See that on the Request Feedback Button on top right, there is a badge states how many requests left to be sent for the current exercise. It should start with 0/10
  3. Submit your answer
  4. Request AI feedback
  5. The number should increase by 1, and become 1/10

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

Code Review

  • Code Review 1
  • Code Review 2
  • Code Review 3
  • Code Review 4

Manual Tests

  • Test 1
  • Test 2
  • Test 3
  • Test 4

Test Coverage

Screenshots

Screenshot 2025-01-30 at 11 29 00 Screenshot 2025-01-30 at 11 58 52

Summary by CodeRabbit

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a feedback request count badge to show the number of feedback requests.
    • Implemented real-time tracking of feedback request limits.
  • Improvements

    • Enhanced feedback request button with visual indicators of request count.
    • Added real-time websocket updates for feedback request tracking.
  • Changes

    • Removed configurable feedback attempt limits in the backend service.

The updates provide more transparent feedback request management for users, with visual indicators of their current request status.

@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) programming Pull requests that affect the corresponding module labels Jan 30, 2025
@ahmetsenturk ahmetsenturk marked this pull request as ready for review January 30, 2025 16:58
@ahmetsenturk ahmetsenturk requested a review from a team as a code owner January 30, 2025 16:58
Copy link

coderabbitai bot commented Jan 30, 2025

Walkthrough

This pull request introduces changes to the feedback request mechanism in an Angular application. The modifications involve removing a configurable feedback attempts limit in the backend service and updating the frontend component to track and display feedback request counts. The changes enhance real-time tracking of feedback requests, with a new limit defined by the instructor and improved websocket-based update handling.

Changes

File Change Summary
src/main/java/.../ProgrammingExerciseCodeReviewFeedbackService.java Removed allowedFeedbackAttempts configuration variable
src/main/webapp/.../request-feedback-button.component.html Added badge to display feedback request count with conditional styling
src/main/webapp/.../request-feedback-button.component.ts Added new properties and methods to track feedback requests:
- currentFeedbackRequestCount
- feedbackRequestLimit
- Implemented websocket-based result tracking

Possibly related PRs

  • Programming exercises: Increase AI feedback request limit #8746: The changes in the main PR, which involve the removal of the allowedFeedbackAttempts variable from the ProgrammingExerciseCodeReviewFeedbackService, are related to the retrieved PR that increases the AI feedback request limit in the same service, as both modifications affect the feedback request handling logic within the same class.
  • Athena: Improve AI feedback request validation #10165: The changes in the main PR, which involve the removal of the allowedFeedbackAttempts variable from the ProgrammingExerciseCodeReviewFeedbackService, are related to the modifications in the retrieved PR that introduce a new allowedFeedbackRequests variable in the AthenaFeedbackSuggestionsService, as both pertain to the management of feedback request limits within the feedback handling logic.
  • Programming exercises: Improve preliminary AI feedback  #9324: The changes in the main PR, which involve the removal of the allowedFeedbackAttempts variable from the ProgrammingExerciseCodeReviewFeedbackService, are related to the modifications in the retrieved PR that update the feedback request logic in the ParticipationResource class, as both PRs impact the handling of feedback requests in the system.

Suggested Labels

tests, ready to merge, athena, exercise, small

Suggested Reviewers

  • EneaGore
  • BBesrour
  • SimonEntholzer
  • krusche
  • HawKhiem

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ae178df and 303fc6c.

📒 Files selected for processing (1)
  • src/main/webapp/app/exercises/shared/exercise-headers/header-participation-page.component.html (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/webapp/app/exercises/shared/exercise-headers/header-participation-page.component.html
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: server-style
  • GitHub Check: client-tests
  • GitHub Check: client-tests-selected
  • GitHub Check: client-style
  • GitHub Check: server-tests
  • GitHub Check: Analyse

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (3)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (2)

33-34: Consider making the feedback limit dynamically configurable.
The hard-coded value is acceptable for now, but pulling it from server or config would be more flexible.


73-76: Prefer strict equality checks.
When filtering results, use === instead of == to avoid unintended type coercion, and directly check boolean flags without == true.

- (result) => result.assessmentType == AssessmentType.AUTOMATIC_ATHENA && result.successful == true
+ (result) => result.assessmentType === AssessmentType.AUTOMATIC_ATHENA && result.successful
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (1)

14-20: Remove unnecessary this. in template expressions.
In Angular templates, referencing component properties without this. is customary and more concise.

- <span>{{ this.currentFeedbackRequestCount }} / {{ this.feedbackRequestLimit }}</span>
+ <span>{{ currentFeedbackRequestCount }} / {{ feedbackRequestLimit }}</span>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f2bff3b and 1e2245b.

📒 Files selected for processing (3)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseCodeReviewFeedbackService.java (0 hunks)
  • src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (2 hunks)
  • src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (6 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseCodeReviewFeedbackService.java
🧰 Additional context used
📓 Path-based instructions (2)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.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

🪛 GitHub Check: client-compilation
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts

[failure] 52-52:
'athenaResultUpdateListener' is declared but its value is never read.

🪛 GitHub Check: client-tests-selected
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts

[failure] 52-52:
'athenaResultUpdateListener' is declared but its value is never read.

🪛 GitHub Check: client-tests
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts

[failure] 52-52:
'athenaResultUpdateListener' is declared but its value is never read.

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: server-tests
  • GitHub Check: Analyse
🔇 Additional comments (4)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (3)

2-2: Use of new RxJS operators is consistent.
No issues found with this import statement.


18-20: Additional imports are relevant and properly used.
The imports for AssessmentType, ParticipationWebsocketService, and Result appear necessary and conform to Angular style.


50-51: Inject usage looks great.
No concerns with the new inject API and spacing.

src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (1)

32-38: Same improvement suggestion for anchor-based badge.
Avoid using this. in Angular templates to keep code consistent and aligned with best practices.

@ahmetsenturk ahmetsenturk marked this pull request as draft January 30, 2025 22:03
@maximiliansoelch maximiliansoelch marked this pull request as ready for review January 31, 2025 18:15
@maximiliansoelch maximiliansoelch added this to the 7.9.1 milestone Jan 31, 2025
Cathy0123456789
Cathy0123456789 previously approved these changes Feb 2, 2025
Copy link

@Cathy0123456789 Cathy0123456789 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 with a Text Exercise. Works as expected, user is shown remaining requests.
image

Copy link
Contributor

@raffifasaro raffifasaro left a comment

Choose a reason for hiding this comment

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

code

Copy link
Member

@maximiliansoelch maximiliansoelch 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.
Code looks good 👍

Copy link

@ItsaaaMeMario ItsaaaMeMario 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.
Bildschirmfoto 2025-02-02 um 21 36 44

@maximiliansoelch maximiliansoelch added ready to merge maintainer-approved The feature maintainer has approved the PR and removed ready for review labels Feb 2, 2025
@krusche krusche changed the title Athena: Badge to display remaining AI feedback requests Athena: Add badge to display remaining AI feedback requests Feb 2, 2025
@krusche krusche modified the milestones: 7.9.2, 7.9.1 Feb 2, 2025
@krusche krusche merged commit 923f16c into develop Feb 2, 2025
53 of 62 checks passed
@krusche krusche deleted the feature/athena/show-remaining-requests branch February 2, 2025 21:24
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!) maintainer-approved The feature maintainer has approved the PR programming Pull requests that affect the corresponding module ready to merge server Pull requests that update Java code. (Added Automatically!)
Projects
Status: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants