-
Notifications
You must be signed in to change notification settings - Fork 289
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
: Add cleanup service for admins
#9296
base: develop
Are you sure you want to change the base?
Conversation
…utions to the database
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 12
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
📒 Files selected for processing (3)
- src/main/java/de/tum/cit/aet/artemis/core/service/cleanup/DataCleanupService.java (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.java (1 hunks)
- src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/main/java/de/tum/cit/aet/artemis/core/service/cleanup/DataCleanupService.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_importssrc/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.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
📓 Learnings (1)
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html (1)
Learnt from: undernagruzez PR: ls1intum/Artemis#9296 File: src/main/webapp/app/admin/cleanup-service/cleanup-service.component.ts:19-44 Timestamp: 2024-09-13T11:36:07.446Z Learning: In `cleanup-service.component.ts`, the date range for cleanup operations is configurable through user input via the date time picker.
🔇 Additional comments (1)
src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.java (1)
100-100
:⚠️ Potential issueEnsure method names reflect called service methods for consistency
The controller method
deleteOldRatedResults
is callingdataCleanupService.deleteNonLatestRatedResults
, which may cause confusion due to differing method names.Please confirm if the intended service method is
deleteOldRatedResults
. If so, consider renaming the service method for consistency.Apply this diff to rename the service method call:
- CleanupServiceExecutionRecordDTO result = dataCleanupService.deleteNonLatestRatedResults(deleteFrom, deleteTo); + CleanupServiceExecutionRecordDTO result = dataCleanupService.deleteOldRatedResults(deleteFrom, deleteTo);Additionally, ensure that the
dataCleanupService
has a method nameddeleteOldRatedResults
.
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html
Show resolved
Hide resolved
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html
Show resolved
Hide resolved
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html
Outdated
Show resolved
Hide resolved
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminOldDataCleanupResource.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/core/service/cleanup/DataCleanupService.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/core/service/cleanup/DataCleanupService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is an issue with the plagiarism deletion, or I'm doing something wrong.
I've got an exercise with multiple plagiarism comparisons on Ts3: https://artemis-test3.artemis.cit.tum.de/course-management/51/text-exercises/569/plagiarism
But for some reason the clean up service does not delete them, when I select the time-frame in which I created them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
📒 Files selected for processing (1)
- src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
📓 Learnings (1)
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html (1)
Learnt from: undernagruzez PR: ls1intum/Artemis#9296 File: src/main/webapp/app/admin/cleanup-service/cleanup-service.component.ts:19-44 Timestamp: 2024-09-13T11:36:07.446Z Learning: In `cleanup-service.component.ts`, the date range for cleanup operations is configurable through user input via the date time picker.
🔇 Additional comments (1)
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html (1)
17-17
: Verify the usage of thetrack
option in the@for
directivePlease ensure that using
track operation
in the@for
directive is correct. In Angular, the tracking mechanism typically usestrackBy
along with a unique identifier or function to optimize rendering performance.Run the following script to check for other usages of
@for
withtrack
in the codebase:This script will help confirm if the usage of
track operation
aligns with the established patterns in the project.✅ Verification successful
Verified: The usage of
track operation
in the@for
directive is consistent with project standards and correctly implemented.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for `@for` directives using 'track' in HTML files. rg --glob '*.html' '@for.*;[[:space:]]*track'Length of output: 77059
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html
Show resolved
Hide resolved
src/main/webapp/app/admin/cleanup-service/cleanup-service.component.html
Show resolved
Hide resolved
There was a problem hiding this 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
🧹 Outside diff range comments (1)
src/main/webapp/i18n/en/global.json (1)
Line range hint
101-120
: Consider standardizing punctuation in the "admin" section.While the new entry follows the style of some existing entries, there's an inconsistency in the use of periods at the end of values in the "admin" section. For improved maintainability and consistency, consider standardizing the punctuation across all entries in a future update.
Example of inconsistency:
"userManagement": "User management", "organizationManagement": "Organization management", "systemNotifications": "System notifications", "featureToggles": "Feature Toggles", "statistics": "User statistics", "metrics": "Metrics", "health": "Health", "configuration": "Configuration", "logs": "Logs", "audits": "Audits", "apidocs": "API", "privacyStatement": "Privacy Statement", "imprint": "Imprint", "database": "Database", "iris": "Iris Settings",
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
📒 Files selected for processing (2)
- src/main/webapp/i18n/de/global.json (1 hunks)
- src/main/webapp/i18n/en/global.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/i18n/de/global.json (1)
Pattern
src/main/webapp/i18n/de/**/*.json
: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".
🔇 Additional comments (1)
src/main/webapp/i18n/de/global.json (1)
118-119
: LGTM! The translation looks good and addresses previous comments.The new entry for "cleanupService" with the translation "Aufräumdienst" is appropriate and uses informal German as required. This change successfully addresses the previous review comments about translating "Cleanup Service" to German.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reapprove
Checklist
General
Server
Client
authorities
to all new routes and checked the course groups for displaying navigation elements (links, buttons).Motivation and Context
Artemis stores a large amount of information, some of which can become corrupted or irrelevant over time. These records occupy significant database space, which can be reclaimed by deleting unused data. This includes old results, unresolved plagiarism cases, and unused feedback.
Currently, there are scripts for cleaning up results and feedback, but no automated process exists for clearing unresolved plagiarism cases. Additionally, orphaned entities, such as results without associated submissions or participation, remain unaddressed, leading to inefficient database usage. Furthermore, these cleanup scripts must be run manually by administrators, which is not ideal. To address these issues, a dedicated cleanup service for administrators was implemented to streamline the process.
Description
A cleanup service has been added to the admin panel, allowing administrators to select specific cleanup operations to perform on the database. They can specify a time period for which the cleanup should be executed, providing flexibility in managing old or unused data. In future iterations, a scheduled job is planned to be introduced, which will automatically execute the cleanup operations periodically, reducing the need for manual intervention and ensuring ongoing database optimization.
Steps for Testing
Prerequisites:
large_course_main.py
script. See README in the folderquick-course-setup
for more details.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
Performance Review
Code Review
Manual Tests
Performance Tests
Test Coverage
Info: ✅ ❌ in Confirmation (assert/expect) have to be adjusted manually, also delete trivial files!
Client
Server
Screenshots
View from the navigation bar
Cleanup service
Confirmation dialog
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes