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: Fix an issue with special characters in task names #9037

Merged

Conversation

pzdr7
Copy link
Contributor

@pzdr7 pzdr7 commented Jul 13, 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.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).

Motivation and Context

Since #8461, we apply the Markdown syntax to tasks in order to show diffs within tasks. This requires us to escape most of the special markdown characters that may occur in both the test case names and the task name.

This caused #9035, where underscores in the task name and the test cases fused together to italicize the entire task.

Description

Escaped more characters from the markdown syntax (we use http://demo.showdownjs.com/) that could cause problems with test case names.

Note that due to a limitation in the showdown-katex extension (no escaping possible e.g. with $$), we cannot prevent incorrect behavior of formulas within tasks.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Student
  • 1 Programming exercise
  1. Log in to Artemis
  2. Navigate to Course management > Your course > Exercises > Your exercise > Edit
  3. Modify the problem statement and check the preview. Check that:
  • If an underscore is present in the task name and in the test name, the task name should not be italicized.
  • If an even number of underscores are present in the task name, there should be no italicized text.
  1. Save the exercise and check that the problem statement also looks good from the student's perspective.
  2. Participate in the exercise and check that the problem statement matches the result the student gets.

Exam mode test

Prerequisites:

  • 1 Exam with a programming exercise
  • 1 Student
  • 1 Instructor (on a different browser/incognito)

Basically - check that #8461 still works.

  1. Log in to Artemis as a student in one browser
  2. Log in to Artemis as an instructor in the second browser or incognito tab
  3. Navigate to the exam as a student and open the programming exercise
  4. As the instructor: Modify the problem statement. In particular, make a change to a task name.
  5. As the student: Verify that the changes to the task & the problem statement in general are highlighted correctly.

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
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Tests

  • Exam Mode Test 1
  • Exam Mode Test 2

Test Coverage

Only trivial changes

Screenshots

Before

image

image

After

image

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of special characters in task or test case names to prevent markdown interpretation issues.

@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Jul 13, 2024
@pzdr7 pzdr7 marked this pull request as ready for review July 14, 2024 20:06
@pzdr7 pzdr7 requested a review from a team as a code owner July 14, 2024 20:06
@pzdr7 pzdr7 requested a review from coolchock July 14, 2024 20:06
Copy link

coderabbitai bot commented Jul 14, 2024

Walkthrough

The update enhances the escapeTaskSpecialCharactersForMarkdown method in the ProgrammingExerciseTaskExtensionWrapper class. By extending the regex pattern to include additional special characters, it ensures that task or test case names are appropriately escaped, preventing markdown interpretation issues.

Changes

Files Change Summary
src/main/webapp/app/exercises/programming/.../programming-exercise-task.extension.ts Updated the escapeTaskSpecialCharactersForMarkdown method to include more characters in the regex pattern for escaping special characters in task/test case names.

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.

@krusche krusche added this to the 7.4.3 milestone Jul 15, 2024
Copy link
Contributor

@JohannesWt JohannesWt 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 TS3 - works as expected / Code also 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 ts3, works as expected. Code LGTM

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 TS2, works as expected. Code LGTM.

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

@krusche krusche merged commit f2a5fc1 into develop Jul 16, 2024
61 of 66 checks passed
@krusche krusche deleted the bugfix/programming-exercises/fix-preview-task-highlighting branch July 16, 2024 16:57
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!) ready for review
Projects
Archived in project
6 participants