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

Development: Fix LTI content selection table not loading #9965

Merged
merged 8 commits into from
Dec 8, 2024

Conversation

raffifasaro
Copy link
Contributor

@raffifasaro raffifasaro commented Dec 7, 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.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • 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

Content selection table for creating lti learning activities was not loading correctly

Description

Change the launch method to take the url path and not a full URL in case of table because of different parameter format given by the table.

Steps for Testing

Prerequisites:

  • Access to Moodle
  • Testserver 1
  1. Make sure you are logged in to Artemis with a Test User 16)

  2. Navigate to Moodle and login with the same test user (Test User 16}, same PW as for the Artemis Test Server)

  3. Go to My Courses and open the lti test course

  4. Activate Edit mode in top right corner

  5. Add a learning activity somewhere by clicking on the blue +
    image

  6. Select TS1
    image

  7. Click on "Select content"
    image

  8. A modal should appear with either a course or a message that there are no lti courses for your user.
    image

(As long as the table does not display a "Am Starten..." or "Starting" message, everything works as expected)

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.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) 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

Test Coverage

Screenshots

Summary by CodeRabbit

  • New Features

    • Enhanced navigation handling for the specific URL '/lti/select-course'.
  • Bug Fixes

    • Improved control flow for determining navigation paths.

@raffifasaro raffifasaro self-assigned this Dec 7, 2024
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Dec 7, 2024
@raffifasaro raffifasaro temporarily deployed to artemis-test1.artemis.cit.tum.de December 7, 2024 15:25 — with GitHub Actions Inactive
Copy link

github-actions bot commented Dec 7, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Dec 7, 2024
@raffifasaro raffifasaro removed the deployment-error Added by deployment workflows if an error occured label Dec 7, 2024
Copy link

coderabbitai bot commented Dec 8, 2024

Walkthrough

The changes in this pull request involve modifications to the replaceWindowLocationWrapper method in the Lti13ExerciseLaunchComponent class. A new conditional check is added to handle the specific URL '/lti/select-course', altering the way the navigation path is determined. The error handling in the storeLtiSessionData method remains unchanged, and the overall structure of the class is preserved.

Changes

File Path Change Summary
src/main/webapp/app/lti/lti13-exercise-launch.component.ts Modified replaceWindowLocationWrapper to include a conditional check for '/lti/select-course' affecting the path variable assignment.

Possibly related issues

Possibly related PRs

Suggested labels

ready for review, bugfix, component:LTI

Suggested reviewers

  • JohannesStoehr
  • Mtze
  • maximiliansoelch

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 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: 1

🧹 Outside diff range and nitpick comments (1)
src/main/webapp/app/lti/lti13-exercise-launch.component.ts (1)

151-156: Consider adding unit tests for URL handling.

The new URL handling logic introduces different paths that should be covered by unit tests.

Would you like me to help generate comprehensive unit tests for the replaceWindowLocationWrapper method? The tests should cover:

  • Direct path for '/lti/select-course'
  • Absolute URLs
  • Relative URLs
  • Malformed URLs
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0005603 and ac3830d.

📒 Files selected for processing (1)
  • src/main/webapp/app/lti/lti13-exercise-launch.component.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/lti/lti13-exercise-launch.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 (1)
src/main/webapp/app/lti/lti13-exercise-launch.component.ts (1)

151-156: Verify the impact on LTI navigation flows.

The changes modify how URLs are handled in the LTI launch flow. Let's ensure this doesn't affect other LTI navigation scenarios.

✅ Verification successful

Let me gather more context about the LTI launch flow to make a more informed decision.


Let me search for more specific information about the LTI launch flow and URL handling.


The URL handling changes in the LTI launch flow are safe and properly implemented

The changes handle two distinct cases correctly:

  • Direct navigation to /lti/select-course preserves the exact path
  • Other URLs are properly parsed to extract their pathname using the URL API

The implementation aligns with both frontend routing patterns and backend LTI configuration, as evidenced by:

  • The select-course path is a well-defined constant LTI13_DEEPLINK_SELECT_COURSE_PATH in the backend
  • The URL handling is consistent with existing LTI navigation flows
  • No other LTI components are affected by this URL parsing change
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other LTI-related navigation code that might be affected
echo "Searching for LTI navigation patterns..."
rg -t ts "router\.navigate.*lti" --no-filename

echo "Searching for URL construction patterns in LTI components..."
fd -e ts -e html . | grep -i "lti" | xargs rg "new URL\(" --no-filename

Length of output: 740


Script:

#!/bin/bash
# Search for the complete implementation of lti13-exercise-launch component
echo "Searching for LTI launch component implementation..."
ast-grep --pattern 'export class Lti13ExerciseLaunchComponent {
  $$$
}'

# Search for URL handling in other LTI components
echo "Searching for URL handling in LTI components..."
rg -t ts "url.*=.*" --no-filename -A 2 | grep -i "lti"

Length of output: 1046


Script:

#!/bin/bash
# Search for the specific file content to understand the context better
echo "Content of lti13-exercise-launch.component.ts:"
rg -A 10 -B 10 "if \(url === '/lti/select-course'\)" 

# Search for LTI-related URL handling patterns
echo "Searching for LTI URL patterns..."
rg -t ts "lti.*url|url.*lti" -A 2

# Search for router navigation related to select-course
echo "Searching for select-course navigation patterns..."
rg "/lti/select-course" -A 2

Length of output: 5164

@krusche krusche changed the title Development: Fix lti content selection table not loading Development: Fix LTI content selection table not loading Dec 8, 2024
@krusche krusche added this to the 7.7.5 milestone Dec 8, 2024
@krusche krusche merged commit 5f19546 into develop Dec 8, 2024
55 of 59 checks passed
@krusche krusche deleted the bugfix/lti-content-selector-not-loading branch December 8, 2024 15:32
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
Status: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants