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: Improve server code #8212

Merged
merged 27 commits into from
Apr 1, 2024
Merged

Development: Improve server code #8212

merged 27 commits into from
Apr 1, 2024

Conversation

krusche
Copy link
Member

@krusche krusche commented Mar 17, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server 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 documented the Java code using JavaDoc style.

Motivation and Context

We want to improve the server code, in particular the REST API and avoid the use of ProfileService if it is not absolutely necessary

Description

  • Move lock and unlock features to separate resources and improve their API design
  • Add other small improvements for code reuse and a more concise implementation
  • Move programming exercise code into a package

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Programming Exercise (in a course)
  • Atlassian or Gitlab setup
  1. Lock all repositories for one programming exercise --> make sure it works
  2. Unlock all repositories for one programming exercise--> make sure it works

Exam Mode Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Exam with two programming exercises
  • Atlassian or Gitlab setup
  1. Lock all repositories for the whole exam --> make sure it works
  2. Unlock all repositories for the whole exam --> make sure it works

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Test Coverage

no changes

Summary by CodeRabbit

  • New Features

    • Introduced new endpoints to lock and unlock all repositories for programming exercises and exams, enhancing control for instructors over version control systems during assessments.
  • Refactor

    • Improved the exam submission logic for better efficiency and readability.
    • Changed HTTP methods from PUT to POST for locking and unlocking repositories, aligning with standard practices.
  • Tests

    • Adjusted test cases to reflect new endpoints and HTTP status codes for repository locking and unlocking functionalities.

@krusche krusche requested a review from a team as a code owner March 17, 2024 13:27
Copy link

coderabbitai bot commented Mar 17, 2024

Walkthrough

This update focuses on enhancing the management of programming exercises and exams within an educational platform, specifically targeting actions like locking and unlocking repositories for both programming exercises and exams. It introduces more efficient handling of exam submissions and refactors various endpoints and services for better readability, maintainability, and functionality. The changes span across backend Java files and frontend TypeScript services, including adjustments to HTTP request methods and URL paths, as well as the organization of test cases to align with the new structure.

Changes

Files Change Summary
.../programming/ProgrammingExerciseLockResource.java
.../ExamLockResource.java
Implements endpoints for locking/unlocking repositories for programming exercises and exams.
.../service/exam/ExamSubmissionService.java Refactors submission logic for improved efficiency and readability.
.../programming/ProgrammingExerciseParticipationResource.java Moves to a new package for better organization.
.../app/exercises/programming/manage/services/programming-exercise.service.ts Changes HTTP method from PUT to POST for unlocking/locking repositories.
.../app/exam/manage/exam-management.service.ts Modifies URLs for unlocking/locking repositories by removing /student-exams from the path.
.../localvcci/LocalVCServiceTest.java
.../exam/ExamIntegrationTest.java
.../exercise/programmingexercise/ProgrammingExerciseIntegrationTestService.java
.../exercise/programmingexercise/ProgrammingExerciseServiceIntegrationTest.java
.../spec/service/programming-exercise.service.spec.ts
Updates import statements and adjusts HTTP status codes and method calls to reflect new structures.

Related issues

  • Issue ls1intum/Artemis#6621 could potentially be linked to this PR. The changes made in the PR, especially regarding the management of programming exercises and exams, might indirectly support the objectives outlined in the issue, such as enhancing the testing process during exam creation and execution. However, direct implementation of the proposed testing steps or automation of dummy test commits is not explicitly mentioned in the PR summary.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Mar 17, 2024
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.

LGTM, but there is an issue with the @Profile annotation, test testLockingAndUnlockingShouldReturnBadRequest fails.

@github-actions github-actions bot added the tests label Mar 17, 2024
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Mar 18, 2024
@krusche krusche modified the milestones: 6.9.3, 6.9.4 Mar 19, 2024
@krusche krusche modified the milestones: 6.9.4, 6.9.5 Mar 24, 2024
@krusche krusche modified the milestones: 6.9.5, 7.0.0 Mar 27, 2024
chrisknedl
chrisknedl previously approved these changes Mar 31, 2024
Copy link
Contributor

@chrisknedl chrisknedl left a comment

Choose a reason for hiding this comment

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

Looks great, I just have one little question.

Copy link
Contributor

@chrisknedl chrisknedl left a comment

Choose a reason for hiding this comment

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

Reapprove after merge conflict

@krusche krusche merged commit 6562f8e into develop Apr 1, 2024
21 of 28 checks passed
@krusche krusche deleted the chore/improve-server-code branch April 1, 2024 14:48
beyzaaltuntas pushed a commit that referenced this pull request Apr 2, 2024
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 server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants