-
Notifications
You must be signed in to change notification settings - Fork 4.1k
do not show lock for teacher #7815
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
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
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
CodeRabbit Configuration File (
|
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)
ozaria/site/components/teacher-dashboard/BaseSingleClass/index.vue (1)
Line range hint
605-614
: Consider extracting default values to a constant.The default return object could be extracted into a constant to improve maintainability and reusability. This would also make it easier to update default values in the future.
Consider this refactor:
+const DEFAULT_PROGRESS_DETAILS = { + status: 'assigned', + normalizedType: 'challengelvl', + isSkipped: false, + lockDate: null, + lastLockDate: null, + isOptional: false, + isPractice: false, +} return { - status: 'assigned', - normalizedType: 'challengelvl', - isLocked, - isSkipped: false, - lockDate: null, - lastLockDate: null, original: aiScenario._id, normalizedOriginal: aiScenario._id, - isOptional: false, isPlayable, - isPractice: false, + isLocked, + ...DEFAULT_PROGRESS_DETAILS, ...details, }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
ozaria/site/components/teacher-dashboard/BaseSingleClass/index.vue
(1 hunks)
🔇 Additional comments (1)
ozaria/site/components/teacher-dashboard/BaseSingleClass/index.vue (1)
Line range hint 599-614
: LGTM! The simplified locking logic improves code clarity.
The changes correctly implement the PR objective of removing the "fake lock" for teachers. The locking logic now solely depends on the ClassroomLib.isModifierActiveForStudent
check, making the code more maintainable and easier to understand.
Let's verify that this is the only place where the locking logic for AI scenarios is implemented:
✅ Verification successful
Since the rg
search shows that isModifierActiveForStudent
with lockedScenario
is only used in the file under review (ozaria/site/components/teacher-dashboard/BaseSingleClass/index.vue
), let's verify if there are any other similar locking mechanisms for AI scenarios:
Let's examine the actual implementation in these files to understand if they are related to the locking logic change:
Let's check if there are any other methods in the codebase that might be using this locking mechanism, particularly focusing on the Vue components and their methods:
Based on all the gathered evidence, I can now generate the final response:
The locking logic changes are correctly implemented and isolated.
The verification shows that:
- The
lockedScenario
modifier is properly defined in the schema (classroom.schema.js
) - The locking functionality is consistently implemented across the codebase:
LockOrSkip.vue
defines the modifier actionsClassroomLib.js
handles the data structureBaseSingleClass/index.vue
implements the actual locking logic
- The
createProgressDetailsByAiScenario
method is only used withinBaseSingleClass/index.vue
- No other components implement alternative AI scenario locking mechanisms
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other potential AI scenario locking implementations
rg -l "isModifierActiveForStudent.*lockedScenario"
Length of output: 119
Script:
#!/bin/bash
# Search for other potential AI scenario locking patterns
rg -l "lockedScenario|isLocked.*aiScenario|aiScenario.*locked"
Length of output: 312
Script:
#!/bin/bash
# Check the context of lockedScenario usage in these files
echo "=== BaseSingleClass.js ==="
rg -C 3 "lockedScenario|isLocked.*aiScenario|aiScenario.*locked" "ozaria/site/store/BaseSingleClass.js"
echo -e "\n=== LockOrSkip.vue ==="
rg -C 3 "lockedScenario|isLocked.*aiScenario|aiScenario.*locked" "ozaria/site/components/teacher-dashboard/BaseSingleClass/table/LockOrSkip.vue"
echo -e "\n=== ClassroomLib.js ==="
rg -C 3 "lockedScenario|isLocked.*aiScenario|aiScenario.*locked" "app/models/ClassroomLib.js"
echo -e "\n=== classroom.schema.js ==="
rg -C 3 "lockedScenario|isLocked.*aiScenario|aiScenario.*locked" "app/schemas/models/classroom.schema.js"
Length of output: 2277
Script:
#!/bin/bash
# Search for methods that might be handling AI scenario locking
ast-grep --pattern 'createProgressDetailsByAiScenario'
# Also check for any other methods with similar naming
rg -C 3 "ProgressDetails.*AiScenario|AiScenario.*Progress"
Length of output: 1711
fix ENG-1350
not sure if we also want to change the student side
lock
, but anyway clean the fake lock in teacher side firstSummary by CodeRabbit