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: Do not always show the request feedback button in the online code editor #9475

Merged
merged 5 commits into from
Oct 13, 2024

Conversation

krusche
Copy link
Member

@krusche krusche commented Oct 13, 2024

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.
  • This is a small issue that I tested locally and was confirmed by another developer on a test server.
  • I chose a title conforming to the naming conventions for pull requests.

Motivation and Context

Since #9324, the Request Feedback or the Request AI Feedback button was always shown in the online code editor, no matter if the corresponding setting was active or not.

Description

Add a check to only show the button when the setting is active

Steps for Testing

Prerequisites:

  • 1 Programming exercise with online code editor enabled
  1. Open the online code editor and make sure the Request Feedback or Request AI Feedback button is not shown
  2. Change the setting of the programming exercise (add a due date, activate manual assessment and activate Manual feedback requests:
  3. Make sure the button is now shown in the online code editor
image image

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

Manual Tests

  • Test 1

Summary by CodeRabbit

  • New Features

    • Introduced a conditional display for the feedback request button based on whether the feedback request feature is enabled.
  • Bug Fixes

    • Simplified feedback request logic by removing unnecessary checks, improving user experience when sending feedback.

@krusche krusche requested a review from a team as a code owner October 13, 2024 19:56
@krusche krusche added this to the 7.6.0 milestone Oct 13, 2024
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Oct 13, 2024
@krusche krusche added the bugfix label Oct 13, 2024
Copy link

coderabbitai bot commented Oct 13, 2024

Caution

Review failed

The head commit changed during the review from 29b481e to 63a03bb.

Walkthrough

The changes in this pull request introduce a conditional check for the requestFeedbackEnabled variable in the RequestFeedbackButtonComponent. This modification restricts the visibility of feedback request UI elements based on whether feedback requests are enabled. Additionally, a new boolean property, requestFeedbackEnabled, is added to manage the feedback request state, and the feedbackSent property is removed to simplify the logic for sending feedback requests. The test suite has also been updated to reflect these changes.

Changes

File Change Summary
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html Introduced a conditional check for requestFeedbackEnabled to control UI display for feedback requests.
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts Added requestFeedbackEnabled property, removed feedbackSent, and updated requestFeedback method.
src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts Enhanced test suite by adding allowFeedbackRequests to Exercise object in multiple test cases.

Possibly related PRs

Suggested labels

enhancement, tests, ready to merge

Suggested reviewers

  • pzdr7
  • FelixTJDietrich
  • egekurt123
  • Jan-Thurner
  • Hialus

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

🧹 Outside diff range comments (1)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (1)

Add unit tests for requestFeedbackEnabled property

The property requestFeedbackEnabled is used in the template for conditional rendering. However, no unit tests are found for this property. Please add unit tests to cover its functionality and initialization.

  • Create or update request-feedback-button.component.spec.ts to include tests for requestFeedbackEnabled
🔗 Analysis chain

Line range hint 1-124: Verify template usage and consider additional improvements.

The changes successfully implement the conditional display of the feedback button. However, ensure that the corresponding template file (request-feedback-button.component.html) is updated to use the new requestFeedbackEnabled property for conditional rendering.

Also, consider the following improvements:

  1. Update unit tests to cover the new requestFeedbackEnabled property and its initialization.
  2. Review and update any documentation or comments related to this component's functionality.

To verify the template usage, run the following command:

Would you like assistance in implementing any of these suggestions or creating unit tests?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if requestFeedbackEnabled is used in the template file

# Test: Search for requestFeedbackEnabled in the template file
rg --type html 'requestFeedbackEnabled' src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html

Length of output: 198


Script:

#!/bin/bash
# Description: Check if 'requestFeedbackEnabled' is used in the unit test file for RequestFeedbackButtonComponent

# Find the unit test file
TEST_FILE=$(fd 'request-feedback-button.component.spec.ts' src/main/webapp/app/overview/exercise-details/request-feedback-button/)

# If the test file exists, search for 'requestFeedbackEnabled' usage
if [ -f "$TEST_FILE" ]; then
    rg 'requestFeedbackEnabled' "$TEST_FILE"
else
    echo "Unit test file not found."
fi

Length of output: 208

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 6549075 and 494e40d.

📒 Files selected for processing (2)
  • src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (1 hunks)
  • src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (2 hunks)
🧰 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

🔇 Additional comments (3)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (2)

1-1: LGTM! Change aligns with PR objectives.

The addition of requestFeedbackEnabled to the condition effectively implements the PR objective of showing the feedback button only when the relevant setting is active. This change enhances the user experience by preventing unnecessary UI clutter.

The use of the new @if directive adheres to the coding guidelines, replacing the older *ngIf syntax.


Line range hint 1-38: Overall implementation looks good and adheres to guidelines.

The entire file consistently uses the new Angular syntax (@if, @else) as per the coding guidelines. The nested conditions and button/link renderings remain logically structured and unchanged from the previous implementation, maintaining the existing functionality while incorporating the new visibility condition.

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

29-29: LGTM: New property added correctly.

The addition of requestFeedbackEnabled property aligns with the PR objective and follows the coding guidelines. It's correctly typed as boolean and uses camelCase naming convention.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 13, 2024
Copy link
Contributor

@DominikRemo DominikRemo left a comment

Choose a reason for hiding this comment

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

Code looks good to me. I tested it on ts2, and the button behaves as expected: it appears when “Request Feedback” is enabled and is hidden when disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix client Pull requests that update TypeScript code. (Added Automatically!) ready for review tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants