-
Notifications
You must be signed in to change notification settings - Fork 300
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
Assessment
: Keep long feedback after saving an assessment
#10090
Conversation
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 pmd (7.8.0)src/main/java/de/tum/cit/aet/artemis/assessment/service/ResultService.javaThe following rules are missing or misspelled in your ruleset file category/vm/bestpractices.xml: BooleanInstantiation, DontImportJavaLang, DuplicateImports, EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock, EmptyStatementNotInLoop, EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, EmptyWhileStmt, ExcessiveClassLength, ExcessiveMethodLength, ImportFromSamePackage, MissingBreakInSwitch, SimplifyBooleanAssertion. Please check your ruleset configuration. WalkthroughThe pull request introduces modifications to the handling of long feedback texts in the Artemis assessment system. Changes are primarily focused on the Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
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: 0
🧹 Nitpick comments (3)
src/main/java/de/tum/cit/aet/artemis/assessment/service/ResultService.java (1)
525-525
: Clarify comment on reattaching old long feedback text.The comment explains connecting old long feedback text before the entity is saved. Consider adding more context or logging to clarify scenarios in which this logic is triggered, for easier debugging.
src/test/java/de/tum/cit/aet/artemis/programming/ProgrammingAssessmentIntegrationTest.java (2)
557-575
: Coverage for existing long feedback retention.This new parameterized test effectively checks if the existing long feedback remains intact across submission boundaries. Consider adding a negative test scenario (e.g., feedback with no content) or an edge case test for extremely large feedback text to ensure coverage of boundary conditions.
577-603
: Reflection-based approach for rewriting feedback field.Manually setting
detailText
via reflection can make the test less robust to internal refactorings. If feasible, prefer a standard setter or a dedicated test utility method to maintain clarity and stability. The rest of the test logic effectively verifies the updated state in the database.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/de/tum/cit/aet/artemis/assessment/service/ResultService.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingAssessmentService.java
(0 hunks)src/test/java/de/tum/cit/aet/artemis/programming/AbstractProgrammingIntegrationIndependentTest.java
(2 hunks)src/test/java/de/tum/cit/aet/artemis/programming/ProgrammingAssessmentIntegrationTest.java
(2 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingAssessmentService.java
🧰 Additional context used
📓 Path-based instructions (3)
src/test/java/de/tum/cit/aet/artemis/programming/AbstractProgrammingIntegrationIndependentTest.java (1)
Pattern src/test/java/**/*.java
: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true
src/main/java/de/tum/cit/aet/artemis/assessment/service/ResultService.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
src/test/java/de/tum/cit/aet/artemis/programming/ProgrammingAssessmentIntegrationTest.java (1)
Pattern src/test/java/**/*.java
: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true
🔇 Additional comments (5)
src/test/java/de/tum/cit/aet/artemis/programming/AbstractProgrammingIntegrationIndependentTest.java (2)
6-6
: Import addition looks appropriate.Adding the import for
LongFeedbackTextRepository
aligns well with the new autowired field usage. Ensure the repository is necessary in this abstract test class and confirm that usage is not duplicated across multiple test classes.
128-129
: Check usage of newly-added repository field.Marking
longFeedbackTextRepository
asprotected
in this abstract test is consistent with other repository fields. Verify that all subclasses correctly utilize and mock the repository where necessary, as direct database access in integration tests can slow down the test suite. Consider verifying that it adheres to the project’s "avoid_db_access" principle for certain test types if applicable.src/main/java/de/tum/cit/aet/artemis/assessment/service/ResultService.java (2)
527-536
: Ensure robust handling of mismatch scenarios.If
feedback.getHasLongFeedbackText()
is true butfeedback.getLongFeedback()
is empty, the code deletes the old entry when changes are detected or reattaches if empty. Confirm that this does not inadvertently remove still-needed data if the client incorrectly reports an empty or missing text. A short additional verification, such as checking content length or a final check after the repository deletion, may help avoid unintentional data loss.
543-543
: Restore association is correct.Re-establishing
feedback
→result
references after saving is typical in JPA-based systems to prevent lazy-loading or cascade issues. The approach is consistent.src/test/java/de/tum/cit/aet/artemis/programming/ProgrammingAssessmentIntegrationTest.java (1)
22-23
: JUnit5 parameterized imports are good.Using
@ParameterizedTest
and@ValueSource
can streamline repetitive test logic. Ensure consistent usage across the file to enhance coverage for different inputs.
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.
Issue discussed with @chrisknedl. Code LGTM and tested locally, the described bug no longer exists. Thanks a lot for helping out with this issue! 👍 :)
src/main/java/de/tum/cit/aet/artemis/assessment/service/ResultService.java
Outdated
Show resolved
Hide resolved
822aa48
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 looks good.
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 looks good 👍
Big thanks to @az108 for helping me with the issue!
Checklist
General
Server
Motivation and Context
When starting an assessment, a new semi-automatic result is created with copies of all the feedbacks from the automatic one. At first, these feedbacks are connected to their long feedback texts if they exist. After saving an assessment, those connections are removed, and after a page reload which clears the cached variables in the client, the long feedback texts are gone.
Description
Long feedback texts are now connected to their associated feedbacks when the latter are saved.
Steps for Testing
Prerequisites:
Easy way to get a long feedback text: Create a Java programming exercise, and inside the test repository, go to the 'SortingExampleBehaviorTest' class. Replace line 48 with
If you now create an assignment repository, this should produce a long feedback text in the corresponding test case.
0%, 0 of 13 passed, 0 points (*some time* ago)
on the top right of the assessment view). One feedback should start with> (See more)
. Click on that, it should show the whole feedback text.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
Manual Tests
Test Coverage
Screenshots
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Tests
Refactor