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

Lectures: Remove guided mode exercise creation shortcut #10022

Merged

Conversation

florian-glombik
Copy link
Contributor

@florian-glombik florian-glombik commented Dec 14, 2024

Checklist

General

Client

Motivation and Context

It is unlikely that editors / instructors will start creating exercises while they are creating a lecture. This step will usually have been completed before the lecture creation and is not something that will be done within a matter of minutes.

While this feature, of navigating from the lecture creation to the exercise creation and back, is only available in the guided mode and the guided mode will be removed in Lectures: Add status bar to lecture creation and edit mode #9655, this PR already removes the "exercise creation shortcut" to keep #9655 at a manageable size.

Description

  • Removes the "exercise creation shortcut"-feature that is only available in the guided mode of the lecture creation

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Create a lecture in guided mode, make sure to add an exercise within the lecture units
  2. Verify there is no "Create new exercise"
  3. Go to the exercise overview
  4. Add the following parameters to the URL ?shouldHaveBackButtonToWizard=true&lectureId=83&step=4
  5. Verify there is no Back to lecture button displayed
  6. Create an exercise, verify that saving worked as expected (write in your review comment which type you tested, test a type that was not yet tested)

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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Old Version

RemoveGuidedModeExeciseCreationShortcut-10022-old

New Version

  • Create new exercise shortcut removed from guided mode
  • Back to lecture button removed from exercise overview (can be tested by adding parameters to URL)

removGuidedModeExerciseCreationShortcut-10022-new

Summary by CodeRabbit

  • New Features

    • Simplified navigation logic across multiple exercise management components.
    • Enhanced clarity in the user interface by removing unnecessary navigation options, including back-to-wizard buttons.
  • Bug Fixes

    • Corrected comments in subscription handling to improve code clarity.
  • Documentation

    • Updated localization files to reflect changes in navigation options.
  • Tests

    • Added new test cases to verify component behavior with query parameters.

@florian-glombik florian-glombik self-assigned this Dec 14, 2024
@florian-glombik florian-glombik added this to the 7.8.0 milestone Dec 14, 2024
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Dec 14, 2024
@florian-glombik florian-glombik added small lecture Pull requests that affect the corresponding module chore deploy:artemis-test6 labels Dec 14, 2024
@florian-glombik florian-glombik marked this pull request as ready for review December 14, 2024 14:49
@florian-glombik florian-glombik requested a review from a team as a code owner December 14, 2024 14:49
@florian-glombik florian-glombik temporarily deployed to artemis-test6.artemis.cit.tum.de December 14, 2024 14:49 — with GitHub Actions Inactive
Copy link

coderabbitai bot commented Dec 14, 2024

Walkthrough

This pull request introduces a comprehensive refactoring of navigation and wizard mode functionality across multiple components in an Angular application. The changes primarily focus on removing back-to-wizard navigation options, simplifying component logic, and streamlining user interfaces. Key modifications include eliminating goBackAfterSaving properties, removing navigation-related query parameters, and updating localization files to reflect these changes.

Changes

File Change Summary
src/main/webapp/app/course/manage/course-management-exercises.component.html Removed conditional button for navigating back to wizard mode
src/main/webapp/app/course/manage/course-management-exercises.component.ts Refactored constructor using inject(), removed navigation-related properties and services
src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts Added faQuestionCircle icon, removed goBackAfterSaving property
src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts Removed Router import and goBackAfterSaving property
src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts Eliminated goBackAfterSaving property and related navigation logic
src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts Removed goBackAfterSaving property and simplified navigation
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts Modified currentWizardStep input and simplified query parameters
src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html Removed [currentWizardStep] binding
src/main/webapp/i18n/de/lecture.json Removed "backToWizard" localization string
src/main/webapp/i18n/en/lecture.json Removed "backToWizard" localization string
src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts Added test case for handling query parameters in TextExerciseUpdateComponent

Suggested Labels

ready to merge, refactoring, lecture

Suggested Reviewers

  • JohannesStoehr
  • Feras797
  • HawKhiem
  • sachmii
  • az108
  • BBesrour

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f464d2 and 6c024df.

📒 Files selected for processing (3)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html (0 hunks)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts (0 hunks)
  • src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html (0 hunks)
💤 Files with no reviewable changes (3)
  • src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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 and nitpick comments (2)
src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts (1)

1-2: LGTM: Simplified navigation handling

The removal of the Router dependency and consolidation of navigation logic through navigationUtilService improves code consistency and maintainability. This change aligns with the PR objective to remove guided mode functionality.

This architectural improvement:

  • Reduces component complexity
  • Centralizes navigation logic
  • Makes the codebase more maintainable
src/main/webapp/app/course/manage/course-management-exercises.component.ts (1)

Line range hint 40-45: Consider safer null handling in route.parent access.

The non-null assertion operator (!) in this.route.parent!.data could lead to runtime errors if the component is used outside the expected routing context.

Consider using optional chaining or adding a null check:

-this.route.parent!.data.subscribe(({ course }) => {
+this.route.parent?.data.subscribe(({ course }) => {
   if (course) {
     this.course = course;
   }
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a6ba30 and 1f464d2.

📒 Files selected for processing (11)
  • src/main/webapp/app/course/manage/course-management-exercises.component.html (0 hunks)
  • src/main/webapp/app/course/manage/course-management-exercises.component.ts (2 hunks)
  • src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts (2 hunks)
  • src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts (1 hunks)
  • src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts (0 hunks)
  • src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts (0 hunks)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts (1 hunks)
  • src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html (0 hunks)
  • src/main/webapp/i18n/de/lecture.json (0 hunks)
  • src/main/webapp/i18n/en/lecture.json (0 hunks)
  • src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts (0 hunks)
💤 Files with no reviewable changes (7)
  • src/main/webapp/app/course/manage/course-management-exercises.component.html
  • src/main/webapp/i18n/en/lecture.json
  • src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html
  • src/main/webapp/i18n/de/lecture.json
  • src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts
  • src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts
  • src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts
🧰 Additional context used
📓 Path-based instructions (4)
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.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

src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.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

src/main/webapp/app/course/manage/course-management-exercises.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

src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.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 (6)
src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts (2)

36-36: LGTM: Icon property follows Angular best practices

The addition of the faQuestionCircle icon as a protected readonly property follows Angular's recommended practices for icon management.


65-68: LGTM: Improved comment accuracy and subscription management

The comment correction from "Subcriptions" to "Subscriptions" improves code documentation quality. The subscription properties are well-organized and properly typed.

src/main/webapp/app/course/manage/course-management-exercises.component.ts (2)

1-1: LGTM! Good use of modern Angular patterns.

The refactoring to use inject() instead of constructor injection follows current Angular best practices and makes the code more maintainable.

Also applies to: 3-3, 35-35


Line range hint 8-91: LGTM! Well-structured component implementation.

The component demonstrates:

  • Clear separation of concerns
  • Proper TypeScript typing
  • Efficient exercise counting and filtering logic
  • Good use of extension points for flexibility
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts (2)

Line range hint 1-24: LGTM! Well-structured component using modern Angular features.

The component follows Angular best practices with proper typing, null safety, and the new input() syntax.


128-130: Verify navigation parameter changes across dependent components.

The removal of wizard-related query parameters aligns with the PR objective to remove the guided mode exercise creation shortcut. However, we should verify that components handling these navigation parameters are updated accordingly.

Let's check for any components that might expect the removed parameters:

✅ Verification successful

Let me search for more specific usage of navigation parameters in the target component and its related components.


Let me check one final aspect - the history of this component to understand what parameters were removed.


Based on the comprehensive search results, I can now provide the final response:

Navigation parameter changes are safe to proceed

The removal of wizard-related query parameters appears to be isolated to this component. Our analysis shows:

  • No other components in the codebase are reading the removed wizard-related query parameters (shouldHaveBackButtonToWizard or step)
  • The only query parameter usage in the lecture unit management is the lectureId, which is being preserved
  • No dependent components were found that expect the removed parameters for exercise creation navigation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for components that might expect the removed query parameters
# Look for components that read 'shouldHaveBackButtonToWizard' or 'step' from query parameters

# Search for query parameter usage in TypeScript files
echo "Searching for query parameter usage in components:"
rg -t ts "queryParamMap.*(?:shouldHaveBackButtonToWizard|step)" src/main/webapp/

# Search for template bindings that might use these parameters
echo "Searching for template bindings:"
rg -t html "(?:\[.*\]|\{\{).*(?:shouldHaveBackButtonToWizard|step)" src/main/webapp/

Length of output: 10649


Script:

#!/bin/bash
# Search for components that handle navigation to/from exercise creation
# Look for router navigation and parameter handling related to exercise creation

# Search for components that navigate to exercise creation
echo "Searching for navigation to exercise creation:"
rg -t ts "router.navigate.*exercise.*create" src/main/webapp/

# Search for components that read exercise-related query parameters
echo "Searching for exercise-related query parameter handling:"
rg -t ts "queryParamMap.*exercise" src/main/webapp/

# Search specifically in the exercise unit directory
echo "Searching in exercise unit components:"
rg -t ts "(queryParams|queryParamMap)" src/main/webapp/app/lecture/lecture-unit/

Length of output: 846


Script:

#!/bin/bash
# Look for the specific component in the PR changes
echo "Searching for the original parameters in the component:"
git diff HEAD^ -- src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts

# Look for any related test files that might verify navigation
echo "Searching for related test files:"
fd -t f "create-exercise-unit.component.spec.ts" src/main/webapp/

Length of output: 405

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 14, 2024
Copy link
Member

@BBesrour BBesrour 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

@az108 az108 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

@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 TS3, the "Create new exercise" button is removed from the guided mode. Also, tested the "back to lecture" with the URL.

Copy link

@HawKhiem HawKhiem 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. No "Create new exercise" is displayed in guided mode. No Back to lecture button displayed with the added URL. I created the following exercises:

  • A programming exercise
  • A quiz in synchronized mode
  • A modelling exercise
  • A text exercise
  • A file upload exercise

The save button works for all the above exercises

Screenshot 2024-12-15 004710
Screenshot 2024-12-15 004931
Screenshot 2024-12-15 004947
Screenshot 2024-12-15 005011
Screenshot 2024-12-15 005051

Copy link

@alekspetrov9e alekspetrov9e 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. No button "Create new exercise" was shown. Added parameters to url and no back to lecture button was displayed.

@florian-glombik florian-glombik added the maintainer-approved The feature maintainer has approved the PR label Dec 17, 2024
@krusche krusche merged commit d10a20c into develop Dec 18, 2024
27 of 30 checks passed
@krusche krusche deleted the chore/lectures/remove-guided-mode-create-exercise-feature branch December 18, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore client Pull requests that update TypeScript code. (Added Automatically!) maintainer-approved The feature maintainer has approved the PR ready for review ready to merge small tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants