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: Add endpoint for learning path competency graph #8649

Merged

Conversation

JohannesStoehr
Copy link
Contributor

@JohannesStoehr JohannesStoehr commented May 22, 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

@JohannesWt wants a new endpoint with the following structure given the learning Path id:

"nodes": [
	 	{
	 		"id": 1,
	 		"label": "Competency 1",
	 		"softDueDate": "21.02.2022, 10:42"
	 		"progress": 50,
	 		"mastery": 50,
	 		"confidence": 80
	 	},
	 	{
	 		"id": 2,
	 		"label": "Competency 2",
	 		"progress": 50,
	 		"mastery": 50,
	 		"confidence": 80
	 	},
	 ],
	 "edges": [
	 	{
	 		"id": 42
	 		"source": 1,
	 		"target": 2,
	 		"type": "extends"
	 	}	
	 ]

Description

Added the endpoint as requested

Steps for Testing

No manual testing possible, since the end point is not yet used

Testserver States

Note

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






Review Progress

Performance Review

  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Test Coverage

Server

Class/File Line Coverage Confirmation (assert/expect)
LearningPathService.java 99%
LearningPathResource.java 98%
CompetencyProgressDTO.java 100%
LearningPathCompetencyGraphDTO.java 100%

@JohannesStoehr JohannesStoehr added ready for review server Pull requests that update Java code. (Added Automatically!) component:LearningPath labels May 22, 2024
@JohannesStoehr JohannesStoehr added this to the 7.1.1 milestone May 22, 2024
@JohannesStoehr JohannesStoehr self-assigned this May 22, 2024
@JohannesStoehr JohannesStoehr requested a review from a team as a code owner May 22, 2024 14:57
@github-actions github-actions bot added the tests label May 22, 2024
Copy link

coderabbitai bot commented May 22, 2024

Walkthrough

The recent changes introduce new DTO classes for managing competency progress and learning path graphs, along with corresponding updates to the service and resource layers to support these features. Additionally, new tests have been added to ensure the integrity and functionality of the learning path competency graph feature.

Changes

Files/Paths Change Summary
src/main/java/de/tum/in/www1/artemis/web/rest/dto/competency/CompetencyProgressDTO.java Introduced CompetencyProgressDTO record class with a static method of to create instances from CompetencyProgress objects.
src/main/java/de/tum/in/www1/artemis/web/rest/dto/competency/LearningPathCompetencyGraphDTO.java Added LearningPathCompetencyGraphDTO record class containing sets of CompetencyProgressDTO and CompetencyRelationDTO.
src/test/java/de/tum/in/www1/artemis/competency/LearningPathIntegrationTest.java Added imports and new methods to test learning path competency graphs, progress, and relations.
src/main/java/de/tum/in/www1/artemis/service/learningpath/LearningPathService.java Updated to include new imports and a method generateLearningPathCompetencyGraph for generating competency graphs.
src/main/java/de/tum/in/www1/artemis/web/rest/LearningPathResource.java Added LearningPathCompetencyGraphDTO, new methods for access control, and modified existing methods for learning path access.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant LearningPathResource
    participant LearningPathService
    participant CompetencyProgressRepository
    participant CompetencyRelationRepository

    User->>+LearningPathResource: getLearningPathCompetencyGraph()
    LearningPathResource->>+LearningPathService: generateLearningPathCompetencyGraph()
    LearningPathService->>+CompetencyProgressRepository: findCompetencyProgressByUser()
    CompetencyProgressRepository-->>-LearningPathService: CompetencyProgress data
    LearningPathService->>+CompetencyRelationRepository: findCompetencyRelations()
    CompetencyRelationRepository-->>-LearningPathService: CompetencyRelation data
    LearningPathService-->>-LearningPathResource: LearningPathCompetencyGraphDTO
    LearningPathResource-->>-User: LearningPathCompetencyGraphDTO
Loading

This sequence diagram illustrates the interaction flow for generating and retrieving a learning path competency graph for a user.


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 42d4be3 and 6d7654f.
Files selected for processing (2)
  • src/main/java/de/tum/in/www1/artemis/web/rest/LearningPathResource.java (5 hunks)
  • src/main/java/de/tum/in/www1/artemis/web/rest/dto/competency/CompetencyProgressDTO.java (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/main/java/de/tum/in/www1/artemis/web/rest/LearningPathResource.java
  • src/main/java/de/tum/in/www1/artemis/web/rest/dto/competency/CompetencyProgressDTO.java

Tip

Early Access Features
  • gpt-4o model for chat

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.
    • @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 as 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 full the 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.

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.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

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

coderabbitai[bot]
coderabbitai bot previously approved these changes May 22, 2024
JohannesWt
JohannesWt previously approved these changes May 22, 2024
Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Code LGTM 👍

coderabbitai[bot]
coderabbitai bot previously approved these changes May 22, 2024
JohannesWt
JohannesWt previously approved these changes May 22, 2024
Copy link
Contributor

@JohannesWt JohannesWt 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 adding softDueDate

pzdr7
pzdr7 previously approved these changes May 22, 2024
Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Code looks good. One small comment

Co-authored-by: Patrik Zander <38403547+pzdr7@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes May 23, 2024
JohannesWt
JohannesWt previously approved these changes May 23, 2024
Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Reapprove 👍

pzdr7
pzdr7 previously approved these changes May 23, 2024
Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Code

JohannesWt
JohannesWt previously approved these changes May 27, 2024
Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

Maintainer approved

@JohannesStoehr JohannesStoehr added ready to merge maintainer-approved The feature maintainer has approved the PR and removed ready for review labels May 28, 2024
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CompetencyProgressDTO(long id, String title, ZonedDateTime softDueDate, Double progress, Double confidence, Double mastery) {

public static CompetencyProgressDTO of(CompetencyProgress competencyProgress) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public static CompetencyProgressDTO of(CompetencyProgress competencyProgress) {
public static CompetencyProgressDTO of(@NotNull CompetencyProgress competencyProgress) {

?

Comment on lines 294 to 295
if (authorizationCheckService.isOnlyStudentInCourse(course, user) && !user.getId().equals(learningPath.getUser().getId())
&& !authorizationCheckService.isAtLeastInstructorInCourse(course, user)) {
Copy link
Member

@bassner bassner May 28, 2024

Choose a reason for hiding this comment

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

Suggested change
if (authorizationCheckService.isOnlyStudentInCourse(course, user) && !user.getId().equals(learningPath.getUser().getId())
&& !authorizationCheckService.isAtLeastInstructorInCourse(course, user)) {
if (authorizationCheckService.isOnlyStudentInCourse(course, user) && !user.equals(learningPath.getUser())) {
  • Users implement equals()
  • The third check appears unnecessary, as we already check that the user is only a student

Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Reapprove

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Reapprove

@bassner bassner merged commit 93ded7a into develop May 29, 2024
36 of 38 checks passed
@bassner bassner deleted the feature/adaptive-learning/learning-path-competency-graph branch May 29, 2024 07:17
@krusche krusche changed the title Learning path: Add Endpoint for Learning Path Competency Graph Development: Add endpoint for learning path competency graph May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:LearningPath ready for review server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants