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

General: Allow direct linking to self-registering courses #6318

Merged
merged 106 commits into from
Apr 15, 2023

Conversation

pal03377
Copy link
Contributor

@pal03377 pal03377 commented Mar 3, 2023

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.

Server

  • I followed the coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I implemented the changes with a good performance and prevented too many database calls.
  • I documented the Java code using JavaDoc style.

Client

  • I followed the coding and design guidelines and ensured that the layout is responsive.
  • 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

This PR implements the suggested change from #6171.
In short, it provides a way to link to self-registration course even if students are not yet registered. Previously, Artemis would show an error message. Now, this PR provides a registration page.

Description

  • Changed the behavior of the /api/courses/{courseId}/for-dashboard endpoint in case of an authentication error: If the user could self-register, but is not registered yet, this endpoint now 302-redirects to /api/courses/{courseId}/for-registration.
  • Added a new endpoint /api/courses/{courseId}/for-registration, which returns reduced information about the course. The endpoint is only accessible for students (and higher roles) who are allowed to self-register in the respective course. The endpoint redirects to /api/courses/{courseId}/for-dashboard if the user is already registered.
  • Refactored the check whether a student can register for a course. Now it's included in the CourseService and more thoroughly tested.
  • Added a registration page for a single course.

screenshot-2023-03-14_001101

  • Refactored the client-side code for course registration: Now the actual registration isn't coupled to the course registration overview page anymore, but to the registration button.
  • Added new redirects:
    • From /courses/{courseId} and /courses/{courseId}/* to /courses/{courseId}/register, if the user can register, but is not yet registered.
    • From /courses/{courseId}/register to /courses/{courseId}, if the user is already registered.

Steps for Testing

Prerequisites:

  • 1 Course with self-registration enabled

screenshot-2023-03-14_001102

  • 1 Student who is not yet registered in that course

Suggestion: Use course with ID 117 "6.0 Testing Session Course 1" on TS1 and your personal TUM login to test. Usually, the course should have self-registration enabled and you probably are not registered with your personal login yet.

  1. Log in to Artemis
  2. Navigate to https:///courses/{courseId}, e.g. https://artemis-test1.artemis.in.tum.de/courses/117
  3. Note that you are being redirected to https:///courses/{courseId}/register

screenshot-2023-03-14_001103

  1. Click the Register button on the page.
  2. Note that a confirmation dialog opens up and that dialog includes the registration confirmation message from the course settings.

screenshot-2023-03-14_001104

  1. Cancel and re-open the dialog to verify that this works as well.
  2. Confirm the registration in the dialog.
  3. Note that you are redirected to the actual course page and that you get a "Registration successful" message.

screenshot-2023-03-14_001105

  1. Now go to the registration page explicitly: Enter https:///courses/{courseId}/register, e.g. https://artemis-test1.artemis.in.tum.de/courses/117/register, in the URL bar of your browser.
  2. Note that you are being redirected to the course page again, as you are already registered.

New Testing Steps: Online Courses

Prerequisites:

  • An Online Course (e.g. https://artemis-test2.artemis.in.tum.de/course-management/8563). Make sure that the Online Course checkmark is checked in the Edit configuration of the course (also disables the Self-Registration checkbox).
  • An instructor of that course (e.g. artemis_test_user_11)
  • A student (e.g. artemis_test_user_1)

Steps:

Review Progress

Code Review

  • Review 1
  • Review 2
  • Review 3

Manual Tests

  • Test 1
  • Test 2
  • Test 3

Test Coverage

File Line % Confirmation
alert.service.ts 72.64%
AuthorizationCheckService.java 75.56%
course-overview.component.ts 75.52%
course-prerequisites-button.component.ts 100.00%
course-registration-button.component.ts 92.31%
course-registration-detail.component.ts 88.46%
course-registration.component.ts 86.67%
Course.java 84.55%
CourseResource.java 91.18% ✅ (CourseTestService)

Screenshots

Registration for course with prerequisites:
screenshot-2023-03-14_001106
screenshot-2023-03-14_001107

@pal03377 pal03377 self-assigned this Mar 3, 2023
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Mar 3, 2023
@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Mar 5, 2023
@github-actions github-actions bot added the tests label Mar 5, 2023
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.

Reapprove code.

Copy link
Member

@julian-christl julian-christl left a comment

Choose a reason for hiding this comment

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

Reapprove code

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

re-aprove

Copy link
Contributor

@simon-hng simon-hng left a comment

Choose a reason for hiding this comment

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

Tested additional steps on TS1

Copy link
Contributor

@frederik-kt frederik-kt left a comment

Choose a reason for hiding this comment

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

Tested additional steps for online courses on TS2. Works as expected.

Copy link
Contributor

@FelixTJDietrich FelixTJDietrich 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 on ts1, also with the additional testing steps. Works as expected.

@krusche krusche changed the title Development: Allow direct linking to self-registering courses General: Allow direct linking to self-registering courses Apr 9, 2023
@krusche krusche added this to the 6.1.3 milestone Apr 15, 2023
@krusche krusche merged commit 0d1ae45 into develop Apr 15, 2023
@krusche krusche deleted the feature/self-registration-on-course-page branch April 15, 2023 15:11
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!) enhancement feature ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow direct linking to self-registering courses