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: Fix sorting on audit event log page #9263

Merged
merged 8 commits into from
Sep 6, 2024

Conversation

SimonEntholzer
Copy link
Contributor

@SimonEntholzer SimonEntholzer commented Sep 1, 2024

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.
  • This is a small issue that I tested locally and was confirmed by another developer on a test server.
  • I chose a title conforming to the naming conventions for pull requests.

Server

Motivation and Context

Fixes #9234

Description

This PR fixes the sorting on the audit events page. The issue occured, because fist the ids of the events is fetched, with the pageable parameter, which delivered them in the correct order. Unfortunately fetching the Entitygraph findWithDataByIdIn(ids) does not preserve this ordering.
This fix sorts the actual events again, by the previously retrieved ids.

TL:DR

  • Audit log page sorting did not work
  • Caused by @Entitygraph not preserving ordering
  • Fix by manual sorting step

Steps for Testing

Prerequisites:

  1. Log in to Artemis as an Administrator
  2. Server Administration -> Audits
  3. Check that sorting by the different columns + switching pages works correctly

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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Before the fix (sorted by user name):
image

After fix, same sorting and date range:
image

@SimonEntholzer SimonEntholzer requested a review from a team as a code owner September 1, 2024 19:21
Copy link

coderabbitai bot commented Sep 1, 2024

Walkthrough

The changes made to the PersistenceAuditEventRepository class enhance the sorting of PersistentAuditEvent objects. Specifically, the methods findAllWithDataByAuditEventDateBetween and findAllWithData were updated to sort the retrieved audit events based on the order of their IDs in the input list, ensuring consistency in the output order.

Changes

Files Change Summary
src/main/java/de/tum/in/www1/artemis/repository/PersistenceAuditEventRepository.java Modified two methods to include sorting of audit events based on the order of IDs in the input list.

Assessment against linked issues

Objective Addressed Explanation
Order in Audit Log is wrong (#9234)

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

@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Sep 1, 2024
Copy link

github-actions bot commented Sep 1, 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 Sep 1, 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

@SimonEntholzer SimonEntholzer added deploy:artemis-test3 and removed deployment-error Added by deployment workflows if an error occured labels Sep 1, 2024
@SimonEntholzer SimonEntholzer temporarily deployed to artemis-test3.artemis.cit.tum.de September 1, 2024 19:37 — with GitHub Actions Inactive
@SimonEntholzer SimonEntholzer changed the title Development: Fix audit log page Development: Fix sorting on audit event log page Sep 1, 2024
Copy link
Contributor

@b-fein b-fein 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 as discussed inline.

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.

Sorting by date, user, and state works on TS3 & works across pages 👍

Copy link
Contributor

@dfuchss dfuchss left a comment

Choose a reason for hiding this comment

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

Code

Copy link
Contributor

@coolchock coolchock 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, sorting works fine. Code also LGTM.

@b-fein b-fein added this to the 7.5.2 milestone Sep 4, 2024
@krusche krusche changed the title Development: Fix sorting on audit event log page General: Fix sorting on audit event log page Sep 6, 2024
@krusche krusche merged commit 0e75579 into develop Sep 6, 2024
16 of 21 checks passed
@krusche krusche deleted the chore/bugfix/fix-audit-log-sorting branch September 6, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix ready to merge server Pull requests that update Java code. (Added Automatically!) small
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Order in Audit Log is wrong
6 participants