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

Assessment: Don't allow activating presentations if no presentation scoring is set #9251

Merged
merged 5 commits into from
Sep 9, 2024

Conversation

Strohgelaender
Copy link
Contributor

@Strohgelaender Strohgelaender commented Aug 28, 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.

Motivation and Context

A conversation on Slack led me to an issue where an instructor activated presentations for an exercise, but then was unable to grade the presentations since the input was missing. This was caused by them not having setup the presentation mode in Artemis before.

Description

You can now only activate presentations for an exercise if the course has a presentation scoring setup.

The issue was caused by the presentation score value being undefined and undefined !== 0 => true .

Steps for Testing

  1. Use a course where no presentation scoring is setup (default behaviour and check that)
  • The exercise overview (course -> exercises) has no presentation column.
  • When editing / creating an exercise the presentation checkbox is not visible.
  1. Setup presentations via course -> score -> grading key. Now verify that:
  • The exercise overview (course -> exercises) shows if an exercise has presentations active.
  • When editing / creating an exercise the presentation checkbox is visible and works.

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.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

  • New Features

    • Enhanced conditional rendering for presentation scores across various exercise components, allowing for broader evaluation of truthy values, improving UI flexibility.
  • Bug Fixes

    • Improved robustness of the presentation score logic, preventing potential runtime errors and ensuring correct display of UI elements based on valid score values.
  • Refactor

    • Simplified conditional checks in multiple components for better readability and maintainability.

@Strohgelaender Strohgelaender requested a review from a team as a code owner August 28, 2024 13:26
Copy link

coderabbitai bot commented Aug 28, 2024

Walkthrough

The changes involve simplifying the conditional checks for the presentationScore property of the course object across multiple component files. The original checks used strict comparisons to determine if presentationScore was not equal to zero, while the updated checks evaluate the truthiness of presentationScore. This modification affects the rendering of UI elements related to presentation scores in various exercise components.

Changes

File Path Change Summary
src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise.component.html
src/main/webapp/app/exercises/modeling/manage/modeling-exercise.component.html
src/main/webapp/app/exercises/programming/manage/programming-exercise.component.html
src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise.component.html
Updated conditional checks for presentationScore from strict comparison (!== 0) to truthy evaluation (presentationScore).
src/main/webapp/app/exercises/shared/presentation-score/presentation-score.component.ts Modified the isBasicPresentation method to use optional chaining and evaluate the truthiness of presentationScore.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Component
    participant Course

    User->>Component: Request exercise view
    Component->>Course: Fetch course data
    Course-->>Component: Return course data with presentationScore
    Component->>Component: Evaluate presentationScore (truthy check)
    alt presentationScore is truthy
        Component->>User: Render presentation score UI
    else presentationScore is falsy
        Component->>User: Do not render presentation score UI
    end
Loading

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.
    • @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.

@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Aug 28, 2024
Copy link
Contributor

@JohannesStoehr JohannesStoehr 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
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.

The code looks good 👍

Copy link
Contributor

@coolchock coolchock 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 ts4, works as expected

Copy link
Contributor

@Jan-Thurner Jan-Thurner 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 TS4, works as expected. Code LGTM.

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Also tested on TS4, breadcrums show up correctly in the repository view 👍

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 comments (1)
src/main/webapp/app/exercises/programming/manage/programming-exercise.component.html (1)

Line range hint 26-30: Overall impact of presentation score condition changes

The modifications to the presentation score conditions in this file are consistent, improve code readability, and align well with the PR objectives. These changes effectively prevent the display of presentation score-related elements when the score is not defined, without introducing any apparent side effects to other parts of the template.

Consider documenting this behavior in the component's TypeScript file or in relevant documentation to ensure that future developers understand the implications of the course.presentationScore property on the UI rendering.

Also applies to: 154-156

@krusche krusche changed the title General: Don't allow activating presentations if no presentation scoring is set Assessment: Don't allow activating presentations if no presentation scoring is set Sep 9, 2024
@krusche krusche added this to the 7.5.2 milestone Sep 9, 2024
@krusche krusche merged commit a902b4d into develop Sep 9, 2024
27 of 32 checks passed
@krusche krusche deleted the bugfix/exercises/presentation-score-undefined branch September 9, 2024 21:05
JohannesWt pushed a commit that referenced this pull request Sep 23, 2024
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
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants