-
Notifications
You must be signed in to change notification settings - Fork 304
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
Quiz exercises
: Disable practice mode for imported exercises
#9683
Conversation
WalkthroughThe Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)src/test/java/de/tum/cit/aet/artemis/quiz/QuizExerciseIntegrationTest.java (1)Pattern 🔇 Additional comments (2)src/test/java/de/tum/cit/aet/artemis/quiz/QuizExerciseIntegrationTest.java (2)
Setting
The assertion 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
🧹 Outside diff range and nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizExerciseImportService.java (1)
116-118
: Add a comment explaining the practice mode behavior.Consider adding a comment to explain why practice mode is explicitly disabled during import, making it clear this is intentional behavior rather than a default value.
+ // Practice mode is intentionally disabled on import to prevent immediate access after quiz ends newExercise.setIsOpenForPractice(false);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizExerciseImportService.java
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizExerciseImportService.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 (1)
src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizExerciseImportService.java (1)
117-117
: LGTM! Verify practice mode behavior.
The change correctly implements the requirement to disable practice mode for imported exercises by explicitly setting isOpenForPractice
to false.
Let's verify that this is the only place where practice mode is set during import:
✅ Verification successful
Practice mode is correctly disabled during import
The verification confirms that setIsOpenForPractice(false)
in QuizExerciseImportService.copyQuizExerciseBasis()
is the only place where practice mode is set during the import process. Other occurrences of setIsOpenForPractice
in the codebase are used in different contexts:
- Test cases and mock data setup
- Quiz exercise initialization
- Quiz exercise reset functionality
- Practice mode management endpoints
The change aligns with the codebase's behavior and doesn't conflict with other functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any other potential locations where practice mode might be set during import
rg -l "setIsOpenForPractice|isOpenForPractice" | xargs -I {} rg -A 5 -B 5 "setIsOpenForPractice|isOpenForPractice" {}
Length of output: 17630
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.
Tested importing a quiz with an activated open-for-practice mode on TS5. As expected, the open-for-practice mode was not activated in the imported quiz. Code looks also 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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizExerciseImportService.java
(1 hunks)src/test/java/de/tum/cit/aet/artemis/quiz/QuizExerciseIntegrationTest.java
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizExerciseImportService.java
🧰 Additional context used
📓 Path-based instructions (1)
src/test/java/de/tum/cit/aet/artemis/quiz/QuizExerciseIntegrationTest.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 (1)
src/test/java/de/tum/cit/aet/artemis/quiz/QuizExerciseIntegrationTest.java (1)
1265-1265
: Duplicate Getter Method Naming Issue
The method isIsOpenForPractice()
arises due to the field being named isOpenForPractice
, leading to a redundant 'is' in the method name. Renaming the field to openForPractice
will produce the cleaner and more conventional getter isOpenForPractice()
.
src/test/java/de/tum/cit/aet/artemis/quiz/QuizExerciseIntegrationTest.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.
Tested on TS5, practice mode did not start after finishing an imported practice-mode-on quiz.
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.
Tested on TS5, problem doesn't occur anymore. Code looks good as well
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 tested importing a quiz with open-for-practice mode enabled on TS5. Works as expected.
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 changes look good to me.
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.
Tested on TS5. Practice mode didnt start for imported exercise
Checklist
General
Server
Motivation and Context
We encountered the case that the practice mode was active for quiz exercises, despite no instructor pressing the button to release it for practice. After some digging I found out that this was, because the flag for this is kept when importing quiz exercises. This means that importing quiz exercises that have the practice mode enabled, will result in a quiz exercise that also has the flag enabled, even before the quiz has even started. Once the quiz ended, the practice mode will immediately be available.
Description
I fixed one line where the old flag was copied and instead ensure that it is false
Steps for Testing
Prerequisites:
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
Test Coverage
Unchanged
Summary by CodeRabbit
New Features
Bug Fixes
Tests
isOpenForPractice
field and validation of import processes between different contexts.