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

Grading: Scroll down to complaint form after clicking on a complain button #10072

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

Conversation

badkeyy
Copy link
Contributor

@badkeyy badkeyy commented Dec 23, 2024

Checklist

General

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

Fixes #9735

Description

Sometimes students were not able to see that the complaint form opened after pressing the "Complain" button. With this PR the browser windows gets scrolled down to the end of the form (To after the submit button) after pressing the button.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Programming Exercise with Complaints enabled
  1. Go to a course that has a text exercice as a student
  2. Start the exercice (type whatever)
  3. Log in as a tutor or instructor and grade the exercice
  4. Login as the original student and open your assesement
  5. Click on the complain button
  6. Find

Exam Mode Testing

Prerequisites:

  • 1 Instructor
  • 1 Students
  • 1 Graded exam with complaint functionallity
  1. Log in to Artemis
  2. Participate in the exam as a student
  3. Grade the exam (Instructor)
  4. Complain about the grading using the "Complain" button as a student

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

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 2
  • Test 1

Screenshots

video
video
video

Summary by CodeRabbit

  • New Features

    • Enhanced complaint submission process with new buttons for filing complaints and requesting more feedback.
    • Automatic scrolling to the complaint form upon button click for improved user experience.
  • Bug Fixes

    • Fixed button actions to correctly invoke the complaint form with appropriate types.
  • Tests

    • Added new test cases to ensure proper functionality of complaint type setting and scrolling behavior.

@badkeyy badkeyy requested a review from a team as a code owner December 23, 2024 14:26
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Dec 23, 2024
Copy link

coderabbitai bot commented Dec 23, 2024

Walkthrough

The pull request enhances the complaints student view component by introducing a more interactive and user-friendly approach to filing complaints. The changes modify the HTML template and TypeScript component to implement automatic scrolling and a more explicit method for opening complaint forms. The implementation addresses user experience issues by ensuring that clicking the complaint button triggers a visible response and smoothly scrolls to the complaint form.

Changes

File Change Summary
src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.html - Updated button click handlers to use openComplaintForm method
- Added #complaintScrollpoint div reference
src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts - Added new imports for view management
- Introduced @ViewChild for scroll point reference
- Added openComplaintForm and scrollToComplaint methods
src/test/javascript/spec/component/complaints/complaint-student-view.component.spec.ts - Added new test cases for complaint type setting
- Imported additional dependencies for testing

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant View
    
    User->>Component: Click Complaint Button
    Component->>Component: openComplaintForm(ComplaintType)
    Component->>View: Trigger Change Detection
    Component->>View: Scroll to Complaint Form
Loading

Assessment against linked issues

Objective Addressed Explanation
Automatically expand complaint section when button is clicked [#9735]
Improve user experience when filing complaints [#9735]
Make complaint form visibility more apparent [#9735]

Possibly related PRs

Suggested labels

small, bugfix, ready to merge, component:Communication

Suggested reviewers

  • HawKhiem
  • florian-glombik
  • sachmii
  • krusche
  • az108
  • JohannesStoehr

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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

🧹 Nitpick comments (3)
src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts (1)

165-170: Scroll behavior is concise and user-friendly.
Using scrollIntoView({ behavior: 'smooth', block: 'end' }) provides a nice user experience. Ensure that all browsers in your support matrix handle this smoothly, or consider a polyfill for older browsers.

src/test/javascript/spec/component/complaints/complaint-student-view.component.spec.ts (1)

242-305: Tests for 'MORE_FEEDBACK' type and scroll behavior mirror the 'COMPLAINT' tests.
These tests provide solid coverage, ensuring that the correct complaint type is set and scrolling happens. Note that there's some duplication between the “COMPLAINT” and “MORE_FEEDBACK” tests. You could refactor common test setup into a helper function if desired.

src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.html (1)

39-39: Added button ID for 'more-feedback'.
Providing a unique ID for the “more feedback” button facilitates better automated testing and accessibility referencing.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 97c0636 and ec2ee11.

📒 Files selected for processing (3)
  • src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.html (3 hunks)
  • src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts (4 hunks)
  • src/test/javascript/spec/component/complaints/complaint-student-view.component.spec.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/test/javascript/spec/component/complaints/complaint-student-view.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.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

src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.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.

🔇 Additional comments (9)
src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts (3)

31-32: Ensure @ViewChild property is initialized.
Declaring the @ViewChild property 'complaintScrollpoint' is good for referencing the DOM element. Just be mindful that it will be undefined until AfterViewInit.


56-56: Constructor injection looks good.
Injecting ChangeDetectorRef to manually trigger change detection is a valid approach, especially before scrolling. This aligns well with Angular guidelines.


155-164: Method to open complaint form is clear and consistent.
The openComplaintForm method properly sets the complaint type, triggers change detection, and proceeds to scroll. This is a clean approach and follows Angular best practices for user-initiated actions.

src/test/javascript/spec/component/complaints/complaint-student-view.component.spec.ts (2)

28-29: New imports are valid.
Imports of ElementRef and ComplaintType are necessary for the newly added fields and tests; no issues found.


151-182: Tests for 'COMPLAINT' type and scroll behavior are thorough.
The test ensures that the complaint type is correctly set and that scrolling is triggered. The mocking of scrollIntoView is a great way to confirm UI behavior. Consider using waitForAsync instead of fakeAsync + tick if you want to rely less on manual timing, but this is optional.

src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.html (4)

19-19: Visibility condition is clear.
Conditionally displaying the complaint action only when the user is correct and no existing complaint is present improves user experience.


27-27: Updated click event for COMPLAINT type.
Replacing direct property assignment with openComplaintForm(ComplaintType.COMPLAINT) centralizes and streamlines logic. This aligns with Angular’s recommended best practices.


42-42: Updated click event for MORE_FEEDBACK type.
Invoking openComplaintForm(ComplaintType.MORE_FEEDBACK) is consistent with the approach for COMPLAINT. Thanks for maintaining this symmetry.


63-63: Div reference added for complaint form scroll.
The #complaintScrollpoint anchor, in conjunction with @ViewChild, is a neat solution for scrolling to the relevant form.

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!) tests
Projects
Status: Work In Progress
Development

Successfully merging this pull request may close these issues.

Clicking on the Complain button appears to do Nothing
1 participant