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

Learning analytics: Fix missing name of attachment lecture units on student dashboard #8781

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

FelixTJDietrich
Copy link
Contributor

@FelixTJDietrich FelixTJDietrich commented Jun 10, 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).

Motivation and Context

The GAD course uses a lot of attachment units and the titles are missing:
Screenshot 2024-06-11 at 00 01 30

Description

Use title of the attachment and include it in the DTO for display.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Course with student analytics course dashboard enabled
  • 1 Attachment lecture unit in the course
  • 1 Competency in the course
  1. Log in to Artemis
  2. Navigate to course with dashboard
  3. Expand the competency of the attachment unit
  4. Verify that the title is no longer missing

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

Manual Tests

  • Test 1
  • Test 2

Test Coverage

no change

Screenshots

Fixed:
Screenshot 2024-06-11 at 00 00 03

Summary by CodeRabbit

  • Bug Fixes
    • Improved data retrieval in lecture unit information by handling potential null values and including attachments for more comprehensive results.

@FelixTJDietrich FelixTJDietrich requested a review from a team as a code owner June 10, 2024 22:10
@FelixTJDietrich FelixTJDietrich self-assigned this Jun 10, 2024
Copy link

coderabbitai bot commented Jun 10, 2024

Walkthrough

The changes enhance the findAllLectureUnitInformationByCourseId method in the LectureUnitMetricsRepository.java by modifying its query to include a left join with the Attachment entity and using the COALESCE function to handle potential null values in the lu.name field. This ensures more robust data retrieval, especially when lu.name might be null.

Changes

File Path Change Summary
`src/main/java/de/tum/in/www1/artemis/repository/metrics/... Updated findAllLectureUnitInformationByCourseId method to include a left join with Attachment and use COALESCE for null handling.

Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 532c869 and e43e8cf.

Files selected for processing (1)
  • src/main/java/de/tum/in/www1/artemis/repository/metrics/LectureUnitMetricsRepository.java (1 hunks)
Additional context used
Path-based instructions (1)
src/main/java/de/tum/in/www1/artemis/repository/metrics/LectureUnitMetricsRepository.java (1)

Pattern src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

Additional comments not posted (2)
src/main/java/de/tum/in/www1/artemis/repository/metrics/LectureUnitMetricsRepository.java (2)

30-32: The modified query now includes a left join with the Attachment entity and uses the COALESCE function to handle potential null values in lu.name. This is a robust solution to ensure that lecture unit titles are displayed correctly on the student dashboard.


30-32: Consider reviewing the performance of this query, especially in scenarios where there are many lecture units and attachments, to ensure that it does not introduce any significant delays.


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 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.

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.

@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) and removed bugfix labels Jun 10, 2024
@FelixTJDietrich FelixTJDietrich added this to the 7.2.1 milestone Jun 10, 2024
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

Comment on lines 30 to 32
SELECT new de.tum.in.www1.artemis.web.rest.dto.metrics.LectureUnitInformationDTO(lu.id, lu.lecture.id, COALESCE(lu.name, a.name), lu.releaseDate, TYPE(lu))
FROM LectureUnit lu
LEFT JOIN Attachment a ON a.attachmentUnit.id = lu.id
Copy link

Choose a reason for hiding this comment

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

The modified query correctly implements the left join with the Attachment entity and uses the COALESCE function to handle potential null values in lecture unit names. This should ensure that titles are displayed correctly on the student dashboard.

Consider reviewing the performance of this query, especially in scenarios where there are many lecture units and attachments, to ensure that it does not introduce any significant delays.

bensofficial
bensofficial previously approved these changes Jun 11, 2024
Copy link
Member

@bensofficial bensofficial left a comment

Choose a reason for hiding this comment

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

Code change looks good to me. Also tested on TS3 and the names are all visible now. Thanks for the fix 🙌.

rstief
rstief previously approved these changes Jun 11, 2024
…eUnitMetricsRepository.java

Co-authored-by: Maximilian Anzinger <44003963+MaximilianAnzinger@users.noreply.github.com>
Copy link
Member

@bensofficial bensofficial 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.

Tested on TS3. Created a lecture unit with type attachment and linked it to a competency. Did not encounter any missing names.

@bassner bassner merged commit 8e9d036 into develop Jun 11, 2024
58 of 59 checks passed
@bassner bassner deleted the bugfix/course-dashboard/missing-attachment-name branch June 11, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix priority:high ready to merge server Pull requests that update Java code. (Added Automatically!)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants