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: Improve template/solution comparison visibility #8745

Conversation

florian-glombik
Copy link
Contributor

@florian-glombik florian-glombik commented Jun 5, 2024

Checklist

General

Client

  • I strictly followed the client coding and design guidelines.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

The template/solution comparison is inconspicuously represented on the programming exercise details page and shall grab instructors' attention to raise awareness of the feature's existence.

Description

  • Using a new icon "faCodeCompare" for the diff feature and changed the button color
  • Added a description and tooltip to the diff feature in the details view, changed the tooltip placement to right
  • Small refactorings (made icons readonly, renamed subscription, introduced enum for tooltip position)
  • Added feature to instructor documentation

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Navigate to the details view of a programming exercise
  2. Verify that the appearance of the template solution comparison is as displayed in the screenshots
  3. Verify the tooltips and translations are working
  4. Verify the documentation is displayed properly https://artemis-platform--8745.org.readthedocs.build/en/8745/user/exercises/programming.html#verify-the-exercise-configuration and easy to understand

Testserver States

Note

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






Review Progress

Performance Review

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Screenshots

Change Before After
Change button color, position, add short description image image
Added tooltip image image
Changed tooltip position image image
Extended Documentation image (New part added between the two displayed sections in this screenshot) image

@florian-glombik florian-glombik requested a review from a team as a code owner June 5, 2024 11:17
Copy link

coderabbitai bot commented Jun 5, 2024

Walkthrough

The updates primarily enhance the user interface for the diff report feature, adding new translations, tooltips, and button functionalities. They also introduce a comparison feature between template and solution repositories, providing clearer guidance and improved interaction for users managing programming exercises.

Changes

File/Path Change Summary
src/.../detail-overview-list.component.html Added translation span, adjusted tooltip placement, changed button icon and type, and updated tooltip placement.
src/.../detail-overview-list.component.ts Updated icon imports, introduced new constants for button type and tooltip placement, renamed variables, and adjusted subscriptions.
src/.../programming-exercise-detail.component.ts Updated title property and introduced titleHelpText for detailed tooltips.
src/.../i18n/de/programmingExercise.json Updated button text, titles, and added short descriptions and detailed tooltips.
src/.../i18n/en/programmingExercise.json Updated button text, titles, and added short descriptions and detailed tooltips.
docs/.../programming-integrated-code-lifecycle-repository-view.inc Introduced a feature for reviewing differences between template and solution repositories.
src/.../button.component.html Added tooltipPlacement binding to the button component.
src/.../button.component.ts Introduced TooltipPlacement enum and tooltipPlacement input property with a default value.
docs/.../programming-exercise-setup.inc Restructured exercise configuration verification, added notes on static code analysis, and introduced a comparison feature for template and solution repositories.

Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between e6927e7 and 03353bb.

Files selected for processing (1)
  • docs/user/exercises/programming-exercise-setup.inc (1 hunks)
Additional comments not posted (2)
docs/user/exercises/programming-exercise-setup.inc (2)

611-612: The description of the template and solution results is clear and concise.


622-624: The revised description enhances clarity on the purpose of the template/solution comparison.


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 as 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.

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.

@florian-glombik florian-glombik added client Pull requests that update TypeScript code. (Added Automatically!) component:Programming small labels Jun 5, 2024
@florian-glombik florian-glombik added this to the 7.2.0 milestone Jun 5, 2024
@florian-glombik florian-glombik self-assigned this Jun 5, 2024
@github-actions github-actions bot added the tests label Jun 5, 2024
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

Outside diff range comments (3)
src/main/webapp/app/shared/components/button.component.ts (1)

Line range hint 1-4: Optimize imports by using TypeScript's import type.

To ensure that these imports are only used for type checking and do not contribute to the runtime bundle size, you can modify the import statements as follows:

- import { IconProp } from '@fortawesome/fontawesome-svg-core';
- import { faCircleNotch } from '@fortawesome/free-solid-svg-icons';
- import { FeatureToggle } from 'app/shared/feature-toggle/feature-toggle.service';
+ import type { IconProp } from '@fortawesome/fontawesome-svg-core';
+ import type { faCircleNotch } from '@fortawesome/free-solid-svg-icons';
+ import type { FeatureToggle } from 'app/shared/feature-toggle/feature-toggle.service';
src/test/javascript/spec/component/detail-overview-list.component.spec.ts (1)

Line range hint 79-79: Avoid using any type to ensure type safety.

Using any can disable TypeScript's static type checking, which can lead to runtime errors. It's better to specify a more precise type:

- null as any as Detail,
+ null as Detail, // or the appropriate type
src/main/webapp/app/exam/manage/student-exams/student-exam-timeline/programming-exam-diff/programming-exercise-exam-diff.component.ts (1)

Line range hint 60-60: Avoid non-null assertions to ensure robust error handling.

Using non-null assertions (!) bypasses TypeScript's strict null checks, which can lead to runtime errors if the values are actually null. Consider handling potential null values explicitly:

- this.previousSubmission.id!,
+ this.previousSubmission?.id,

Also applies to: 76-76, 79-79, 112-112, 118-118, 144-144

Tools
Biome

[error] 10-11: All these imports are only used as types. (lint/style/useImportType)

Importing the types with import type ensures that they are removed by the transpilers and avoids loading unnecessary modules.
Safe fix: Use import type.


[error] 11-12: All these imports are only used as types. (lint/style/useImportType)

Importing the types with import type ensures that they are removed by the transpilers and avoids loading unnecessary modules.
Safe fix: Use import type.


[error] 13-14: All these imports are only used as types. (lint/style/useImportType)

Importing the types with import type ensures that they are removed by the transpilers and avoids loading unnecessary modules.
Safe fix: Use import type.


[error] 15-16: Some named imports are only used as types. (lint/style/useImportType)

This import is only used as a type.

This import is only used as a type.

Importing the types with import type ensures that they are removed by the transpilers and avoids loading unnecessary modules.
Safe fix: Use import type.

@@ -570,7 +572,6 @@
},
"errorWhileFetchingRepos": "Fehler beim Abrufen der Repositories. Bitte überprüfe deine Internetverbindung und öffne das Popup erneut.",
"404": "Template-Lösungs-Diff wurde noch nicht generiert. Bitte pusche etwas in die Template- oder Lösungs-Repositories, um ihn zu erstellen.",
"lineStatLabel": "Zeilen, die zwischen Vorlage und Lösung hinzugefügt/entfernt wurden",
Copy link
Contributor Author

@florian-glombik florian-glombik Jun 5, 2024

Choose a reason for hiding this comment

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

The translation is not used anymore, see src/main/webapp/app/exercises/programming/manage/programming-exercise-detail.component.ts

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 (4)
src/main/webapp/app/exercises/programming/manage/programming-exercise-detail.component.ts (4)

Line range hint 162-162: Replace non-null assertions with optional chaining.

Using non-null assertions can lead to runtime errors if the object is actually null. It's safer to use optional chaining (?.) which includes runtime checks.

- programmingExercise.id!
+ programmingExercise.id?

Please apply this change to all similar instances in the file.

Also applies to: 164-164, 183-183, 185-185, 223-223, 234-234, 249-249, 431-431, 443-443, 548-548


Line range hint 235-235: Avoid assignments within expressions.

Assignments within expressions can lead to confusing code that is hard to read and maintain. Consider refactoring this to separate the assignment and the expression.


Line range hint 470-470: Use template literals instead of string concatenation.

Template literals provide a clearer and more concise way to handle strings that involve variables. They also improve readability.

- 'string' + variable
+ `string ${variable}`

Please apply this change to all similar instances in the file.

Also applies to: 481-481, 547-549


Line range hint 517-517: Use strict equality for comparisons.

Using != can lead to unexpected type coercion. It's safer and more predictable to use !== for comparisons, ensuring that both the type and value match.

- if (variable != null)
+ if (variable !== null)

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 5, 2024
Copy link
Member

@Hialus Hialus 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. Code changes also look good.

Well done 🚀

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 again in a testing session (TS2). LGTM 👍

Copy link
Contributor

@laadvo laadvo left a comment

Choose a reason for hiding this comment

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

Tested in testing session on ts2, nice improvement 👍

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 in a TS on TS2, works as expected. Code lgtm.

@krusche krusche merged commit 3039730 into develop Jun 6, 2024
46 of 49 checks passed
@krusche krusche deleted the chore/programming-exercises/improve-template-solution-diff-visibility branch June 6, 2024 17:15
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!) component:Programming documentation ready to merge small tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants