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

General: Do not show unenrollment button to tutors #8416

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

JohannesStoehr
Copy link
Contributor

@JohannesStoehr JohannesStoehr commented Apr 16, 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.
  • I strictly followed the client coding and design guidelines.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Tutors should not be able to unenroll themselves from a course, especially from the student view.

Description

Hide the unenroll button for every user that is at least a tutor.

Steps for Testing

Prerequisites:

  • 1 Instructor/Tutor
  • 1 Student
  1. Log in to Artemis
  2. Create/Find a course where the enrollment period is currently running
  3. Check that a tutor/Instructor doesn't see the unenrollment button in the course view
  4. Check that the student does see the unenrollment button

Testserver States

Note

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







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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Screenshots

Bildschirmfoto 2024-04-16 um 19 36 09

Summary by CodeRabbit

  • Bug Fixes
    • Updated the conditions under which a student can unenroll from a course, ensuring they can only do so if the course is not at the tutor level or higher.

@JohannesStoehr JohannesStoehr added ready for review client Pull requests that update TypeScript code. (Added Automatically!) small bugfix user interface labels Apr 16, 2024
@JohannesStoehr JohannesStoehr added this to the 7.0.1 milestone Apr 16, 2024
@JohannesStoehr JohannesStoehr self-assigned this Apr 16, 2024
@JohannesStoehr JohannesStoehr requested a review from a team as a code owner April 16, 2024 17:39
Copy link

coderabbitai bot commented Apr 16, 2024

Walkthrough

The update to the CourseOverviewComponent enhances the unenrollment logic. It now includes a condition that checks the tutor status of the course. Students can unenroll only if they meet the existing criteria and if the course is not categorized as at least tutor-level, adding an extra layer of restriction based on the course's educational status.

Changes

File Path Change Summary
.../app/overview/course-overview.component.ts Updated unenrollment logic to include a check for the course's tutor status in CourseOverviewComponent.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4d7b40e and 4a46a36.
Files selected for processing (1)
  • src/main/webapp/app/overview/course-overview.component.ts (1 hunks)
Additional Context Used
Path-based Instructions (1)
src/main/webapp/app/overview/course-overview.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 not posted (1)
src/main/webapp/app/overview/course-overview.component.ts (1)

201-201: Ensure the new condition in getCourseActionItems method is robust and correctly implements the intended functionality.

Verification successful

The search results from the rg command have successfully located the definition and usage of the getCourseActionItems method within the TypeScript files of the project. Here are the key findings:

  1. Definition of getCourseActionItems: The method is defined in src/main/webapp/app/overview/course-overview.component.ts. It returns an array of CourseActionItem.

  2. Usage in Component: The method is called within the same file (course-overview.component.ts) to set this.courseActionItems.

  3. Test Usage: The method is also referenced in the test file src/test/javascript/spec/component/course/course-overview.component.spec.ts, where it is spied on and its invocation is checked.

These findings confirm that the method getCourseActionItems is actively used in the codebase and is integral to the functionality of the course-overview.component. The method's implementation and its call are consistent with the typical usage patterns in Angular applications, suggesting that the new condition added to this method should be functioning as intended if correctly implemented within the method's logic.

Given this information, the review comment concerning the robustness and correct implementation of the new condition in the getCourseActionItems method appears to be verified based on the method's active use and critical role in the component.

Conclusion: The new condition in the getCourseActionItems method is verified to be correctly placed and used within the context of the course-overview.component.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for usages of `getCourseActionItems` to ensure it's being used correctly in context.
ast-grep --lang typescript --pattern $'getCourseActionItems() {
  $$$
}'

Length of output: 528



Script:

#!/bin/bash
# Corrected search for the definition and usage of `getCourseActionItems` method in TypeScript files.
ast-grep --lang typescript --pattern $'method_definition[name="getCourseActionItems"] { $$$ }'

Length of output: 572



Script:

#!/bin/bash
# Search for the definition and usage of `getCourseActionItems` method in TypeScript files using ripgrep.
rg --type ts "getCourseActionItems"

Length of output: 559


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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
Member

@julian-christl julian-christl left a comment

Choose a reason for hiding this comment

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

code lgtm

Copy link
Contributor

@pzdr7 pzdr7 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 TS1.

  • Student can see the button
  • Instructor/Tutor cannot see the button

Works as expected ✅

@krusche krusche changed the title General: Don't Show Unenrollment Button to Tutors General: Do not show unenrollment button to tutors Apr 21, 2024
@krusche krusche merged commit a3e3ddf into develop Apr 21, 2024
66 of 70 checks passed
@krusche krusche deleted the bugfix/general/dont-show-unenroll-to-tutors branch April 21, 2024 10:36
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 to merge small user interface
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants