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: Add simple mode to create and edit view #9283

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

Conversation

florian-glombik
Copy link
Contributor

@florian-glombik florian-glombik commented Sep 4, 2024

Checklist

General

Client

  • I strictly followed the client coding and design guidelines.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines. (added tests for the grading component)
  • 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

Programming exercises offer diverse configuration options and can be overwhelming to configure for new users (new instructors).
This PR should allow instructors to lower the learning curve for the configuration programming exercises, allowing new instructors to get started with creating basic programming exercises.
If advanced features are needed, it is easy to switch to the advanced mode for the respective configuration detail.
The current selection of configuration options is a starting point, as multiple different opinions are likely to be present, some which might not have been considered yet, it shall be simple to adjust the configuration option that are available in the simple mode (modification via a simple datastructure).

Description

  • Added the new simple mode for the configuration of programming exercises that displays a reduced subset of configuration options
  • Added a button to switch between the simple mode and the advanced mode
  • Added a datastructure (see programming-exercise-update.helper.ts) to easily allow a modification of which fields are displayed in the simple mode/advanced mode (this also includes adding a bunch of if checks in the respective template parts)
  • Added a folder structure for update components
  • Unified touched components (made readonly variables protected and moved them to the top of the component)
  • Fixed initialization of isEdit variable in programming-exercise-update.component.ts
  • Save the isSimpleMode value in the localStorage to keep the mode after a page reload
  • Introduced signals where possible with reasonable effort
  • Fixed console error in category-selector.component.ts
  • Added client validation for exerciseTitle (for all exercise types) and shortName

Note

  • I am using Signals, e.g. for isSimpleMode, which are called in the template with isSimpleMode() to access the respective value. This is not a standard function call that would need to be prevented in the template.
  • It is intended that the short name of a programming exercise cannot be edited after the creation. This has implications on the build system and would require a potentially expensive renaming of existing repositories or tracking of renamings.

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Create a new programming exercise in the simple mode
  2. Verify that a valid Short Name was created
  3. Verify the creation was successful without any problems
  4. Verify that switching between the simple mode and the advanced mode works as expected
  5. Edit an exercise
  6. Verify editing and saving the respective changes works
  7. Import an exercise
  8. Verify there are no problems during the import
  9. Verify there is no change in behaviour for other exercise types (text, modeling, file upload, quiz)

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

Test Coverage

Link to E2E tests Playwright (MySQL, Local)

Client

Class/File Line Coverage Confirmation (assert/expect)
exam-update.component.ts 88.95%
add-auxiliary-repository-button.component.ts 100%
programming-exercise-update.component.ts 88.44%
programming-exercise-update.helper.ts 100%
switch-edit-mode-button.component.ts 100%
programming-exercise-information.component.ts 91.05%
programming-exercise-lifecycle.component.ts 95.23%
exercise-title-channel-name.component.ts 96.77%
form-footer.component.ts 100%
form-status-bar.component.ts 84.61%
title-channel-name.component.ts 100%
utils.ts 96.72%
custom-not-included-in-validator.directive.ts 30%

Screenshots

New

New simple mode with option to switch to the advanced mode and back

Screencast:

simpleModePreview

Screenshots:
Screenshot 2024-10-23 at 13 38 28

Screenshot 2024-10-23 at 13 39 38

Old

versionBeforeSipleMode

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a toggle button for switching between simple and advanced edit modes for programming exercises.
    • Added new components for selecting difficulty levels in programming exercises.
    • Implemented a new ProgrammingExerciseInformationComponent for enhanced management of programming exercises.
  • Enhancements

    • Improved user interface and conditional rendering for various components related to programming exercises.
    • Enhanced stability and error handling in the course detail component.
    • Refined the component structure and organization for better maintainability.
    • Integrated reactive programming concepts across multiple components for improved state management and responsiveness.
    • Enhanced encapsulation and access control for component properties.
  • Localization

    • Updated user interface labels for programming exercise management in multiple languages.
  • Tests

    • Enhanced test coverage for various components related to programming exercises, including lifecycle and update components.
    • Improved test initialization and setup for the ProgrammingExerciseInformationComponent.

@florian-glombik florian-glombik self-assigned this Sep 4, 2024
@florian-glombik florian-glombik added feature client Pull requests that update TypeScript code. (Added Automatically!) component:Programming labels Sep 4, 2024
@florian-glombik florian-glombik added this to the 7.5.3 milestone Sep 4, 2024
@florian-glombik florian-glombik changed the title Feature: Add simple mode to programming exercises Programming exercises: Add simple mode to edit view Sep 4, 2024
@github-actions github-actions bot added the tests label Sep 4, 2024
…mode

# Conflicts:
#	src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.html
#	src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.html
#	src/main/webapp/app/exercises/programming/manage/update/programming-exercise-update.component.html
#	src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.html
#	src/main/webapp/app/forms/form-footer/form-footer.component.html
#	src/main/webapp/app/forms/form-footer/form-footer.component.ts
sachmii
sachmii previously approved these changes Oct 27, 2024
Copy link

@sachmii sachmii 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 TS5, everything still works as described.

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 core Pull requests that affect the corresponding module playwright programming Pull requests that affect the corresponding module server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.