-
Notifications
You must be signed in to change notification settings - Fork 14
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
enhance(apps/frontend-manage): limit group activity creation to courses where group creation is enabled #4259
Conversation
…es where group creation is enabled
Current Aviator status
This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
WalkthroughWalkthroughThe pull request introduces significant modifications across multiple components and hooks in the frontend application, primarily focusing on the handling of course selection and group creation functionalities. Key changes include the addition of the Changes
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 (
|
Quality Gate failedFailed conditions |
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)
packages/i18n/messages/de.ts (1)
Line range hint
1202-1203
: Translate the message to German for consistency.The
groupActivityName
message is in English, while the rest of the file is in German.Apply this diff to fix the issue:
- groupActivityName: - 'This name should allow you to distinguish this group activity from others. It will not be shown to the participants, please use the display name (next field) for this.', + groupActivityName: + 'Dieser Name sollte es Ihnen ermöglichen, diese Gruppenaktivität von anderen zu unterscheiden. Er wird den Teilnehmenden nicht angezeigt, bitte verwenden Sie dafür den Anzeigenamen (nächstes Feld).',
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (16)
- apps/frontend-manage/src/components/sessions/creation/ElementCreation.tsx (6 hunks)
- apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivityInformationStep.tsx (3 hunks)
- apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivitySettingsStep.tsx (2 hunks)
- apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivityWizard.tsx (7 hunks)
- apps/frontend-manage/src/components/sessions/creation/liveQuiz/LiveSessionWizard.tsx (4 hunks)
- apps/frontend-manage/src/components/sessions/creation/microLearning/MicroLearningWizard.tsx (4 hunks)
- apps/frontend-manage/src/components/sessions/creation/practiceQuiz/PracticeQuizWizard.tsx (4 hunks)
- apps/frontend-manage/src/lib/hooks/useCoursesGamificationSplit.tsx (1 hunks)
- apps/frontend-manage/src/lib/hooks/useCoursesGroupsSplit.tsx (1 hunks)
- apps/frontend-manage/src/lib/hooks/useGroupsCourseGrouping.tsx (1 hunks)
- packages/graphql/src/graphql/ops/QGetUserCourses.graphql (1 hunks)
- packages/graphql/src/ops.ts (2 hunks)
- packages/graphql/src/public/client.json (1 hunks)
- packages/graphql/src/public/server.json (1 hunks)
- packages/i18n/messages/de.ts (3 hunks)
- packages/i18n/messages/en.ts (3 hunks)
Additional comments not posted (35)
packages/graphql/src/graphql/ops/QGetUserCourses.graphql (1)
9-9
: LGTM!The addition of the
isGroupCreationEnabled
field to theGetUserCourses
query is a valid change that enhances the functionality by providing additional context about the courses. The field name is clear and descriptive, and it is correctly placed within theuserCourses
object, maintaining the structure of the query.apps/frontend-manage/src/lib/hooks/useGroupsCourseGrouping.tsx (1)
1-30
: LGTM!The code changes are approved. The custom hook
useGroupsCourseGrouping
is well-structured, follows best practices, and provides a reusable way to group courses based on whether they have groups or not. The use of TypeScript and theuseTranslations
hook for internationalization is also commendable.apps/frontend-manage/src/lib/hooks/useCoursesGamificationSplit.tsx (1)
1-32
: LGTM!The custom hook
useCoursesGamificationSplit
is well-structured and follows a clear logic for splitting the providedcourseSelection
array into two arrays based on theisGamified
property. The use of thereduce
function is appropriate for categorizing the courses, and the hook handles the case whencourseSelection
isundefined
to avoid potential errors. The addition of thedata
property with thecy
property for testing purposes is a good practice. The hook is exported as a default export, making it easy to import and use in other components.The code changes are approved.
apps/frontend-manage/src/lib/hooks/useCoursesGroupsSplit.tsx (1)
1-32
: LGTM!The
useCoursesGroupsSplit
hook is correctly splitting thecourseSelection
array into two arrays based on theisGroupCreationEnabled
property of each course object. It is also adding adata
property with acy
key to each course object in the split arrays, which could be used for testing purposes. The hook is returning an object with the two split arrays, which is a good way to return multiple values from a hook. It is also using optional chaining and nullish coalescing to handle the case wherecourseSelection
is undefined, which is a good practice to avoid errors.The code changes are approved.
apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivityInformationStep.tsx (4)
21-22
: LGTM!The changes to the component parameters are consistent with the new approach to managing course data.
28-28
: LGTM!The introduction of the
noCoursesWithGroups
variable simplifies the logic and improves clarity.
Line range hint
48-54
: LGTM!The conditional rendering of the
UserNotification
component based onnoCoursesWithGroups
provides a user-friendly message when there are no courses with groups available.
138-138
: LGTM!Deriving the
continueDisabled
prop fromnoCoursesWithGroups
enhances the component's responsiveness to the current state of course data.apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivitySettingsStep.tsx (3)
3-3
: LGTM!The import statement change is approved.
34-39
: LGTM!The function call change is approved.
26-27
: LGTM!The function parameter change is approved.
apps/frontend-manage/src/components/sessions/creation/ElementCreation.tsx (3)
34-35
: LGTM!The changes to the
ElementSelectCourse
type are approved. The addition of theisGroupCreationEnabled
property and making thedata
property optional align with the goals mentioned in the AI-generated summary.
113-118
: LGTM!The changes to the course mapping are approved. Including the
isGroupCreationEnabled
property in the mapped object aligns with the goals mentioned in the AI-generated summary and ensures that the property is available for use in the component's logic.Also applies to: 122-122
174-174
: LGTM!The change to the
courses
prop assignment is approved. Using the nullish coalescing operator (??
) to provide a fallback to an empty array is a good practice to prevent passingnull
orundefined
values to thecourses
prop.apps/frontend-manage/src/components/sessions/creation/liveQuiz/LiveSessionWizard.tsx (3)
12-12
: LGTM!The import statement for the
useCoursesGamificationSplit
hook is correctly written.
49-49
: LGTM!The changes to the
LiveSessionWizardProps
interface are approved.Consolidating the
gamifiedCourses
andnonGamifiedCourses
props into a singlecourses
prop simplifies the interface and centralizes the course data handling. TheuseCoursesGamificationSplit
hook can be used to split thecourses
prop within the component.
77-80
: LGTM!The usage of the
useCoursesGamificationSplit
hook in theLiveSessionWizard
component is approved.Invoking the hook with the
courses
prop to derive thegamifiedCourses
andnonGamifiedCourses
variables improves the component's logic by centralizing the course data handling and enhancing the separation of concerns. The derived variables are correctly passed as props to theLiveQuizSettingsStep
component.apps/frontend-manage/src/components/sessions/creation/microLearning/MicroLearningWizard.tsx (2)
Line range hint
59-92
: LGTM!The changes to the
MicroLearningWizardProps
interface and the usage of theuseCoursesGamificationSplit
hook are a good refactoring that simplifies the component's props and improves the separation of concerns.
Line range hint
280-320
: LGTM!The usage of
gamifiedCourses
andnonGamifiedCourses
in theMicroLearningInformationStep
andMicroLearningSettingsStep
components is consistent with the changes made to theMicroLearningWizard
component.Also applies to: 340-380
apps/frontend-manage/src/components/sessions/creation/practiceQuiz/PracticeQuizWizard.tsx (4)
10-10
: LGTM!The code change is approved.
60-60
: LGTM!The code change is approved. The interface change simplifies the props by consolidating the course properties.
71-71
: LGTM!The code change is approved. The function parameter change is consistent with the interface change.
94-96
: LGTM!The code change is approved. The hook is correctly used to derive
gamifiedCourses
andnonGamifiedCourses
from thecourses
prop.apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivityWizard.tsx (3)
10-10
: Approve the introduction of theuseCoursesGroupsSplit
hook.The changes to the component's props and the introduction of the
useCoursesGroupsSplit
hook are approved. The hook handles the splitting of courses based on the presence of groups, which aligns with the new categorization of courses.Also applies to: 90-92
326-328
: Approve the updated logic for determining the disabled state of the continue button.The logic for determining the disabled state of the continue button in the
GroupActivityInformationStep
has been updated to check the length ofcoursesWithGroups
. This change is approved as it simplifies the control flow and aligns with the new categorization of courses.
365-366
: Approve the changes to the props passed to theGroupActivitySettingsStep
.The
GroupActivitySettingsStep
now receives thecoursesWithGroups
andcoursesWithoutGroups
props, which is consistent with the changes made to the component's props and the new categorization of courses. These changes are approved.packages/graphql/src/public/client.json (1)
139-139
: Acknowledge hash value update for "GetUserCourses".The hash value for the "GetUserCourses" key has been updated, indicating a change in the underlying implementation or data.
Ensure that this change is thoroughly tested to confirm that the "GetUserCourses" functionality behaves as expected and does not introduce any regressions.
Run the following script to verify the usage of "GetUserCourses":
Verification successful
Ensure thorough testing of "GetUserCourses" functionality.
The "GetUserCourses" query is used in several parts of the codebase, including:
packages/graphql/src/ops.ts
: Defines the query type and document.apps/frontend-manage/src/components/sessions/creation/ElementCreation.tsx
: Utilizes the query in a component.apps/frontend-manage/src/pages/courses/index.tsx
: Utilizes the query in a page.Given the hash update, please ensure that these components and pages are thoroughly tested to confirm that they work correctly with the updated query implementation.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of "GetUserCourses" in the codebase. # Test: Search for the usage of "GetUserCourses". Expect: Only valid usages with the updated implementation. rg --type typescript --type javascript --type graphql -A 5 $'GetUserCourses'Length of output: 110
Script:
#!/bin/bash # Description: Verify the usage of "GetUserCourses" in the codebase. # Test: Search for the usage of "GetUserCourses". Expect: Only valid usages with the updated implementation. rg --type ts --type js -A 5 $'GetUserCourses'Length of output: 11206
packages/graphql/src/public/server.json (1)
139-140
: LGTM!The addition of the
isGroupCreationEnabled
field to theuserCourses
object in theGetUserCourses
query looks good. It provides more information about each user course, specifically whether group creation is enabled for that course. This change aligns with the PR objective to limit group activity creation to courses where group creation is enabled.The change is additive and does not break existing functionality.
packages/i18n/messages/en.ts (2)
208-209
: LGTM!The new localized strings
withGroups
andwithoutGroups
have been added correctly.
1163-1163
: Looks good!The modified
groupActivityNoCourse
string provides clearer instructions to users about the requirements for creating group activities.packages/i18n/messages/de.ts (3)
208-209
: LGTM!The code changes are approved. The new entries
withGroups
andwithoutGroups
enhance the German localization for group-related functionalities.
1170-1171
: LGTM!The code changes are approved. The updated
groupActivityNoCourse
message provides clearer instructions to the user about the prerequisites for creating group activities.
Line range hint
1173-1174
: LGTM!The code changes are approved. The new
groupActivityIntroductionName
message provides helpful guidance to the user when creating a group activity.packages/graphql/src/ops.ts (2)
3268-3268
: LGTM!The code changes are approved.
3519-3519
: LGTM!The code changes are approved.
klicker-uzh Run #2946
Run Properties:
|
Project |
klicker-uzh
|
Branch Review |
limit-group-activity-creation
|
Run status |
Passed #2946
|
Run duration | 09m 06s |
Commit |
c9eced6341 ℹ️: Merge b593194045a38256825958ead1790b54d1e541ca into 7ed9ffb18d136f5d57c37e77968d...
|
Committer | Julius Schlapbach |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
1
|
Pending |
0
|
Skipped |
0
|
Passing |
43
|
View all changes introduced in this branch ↗︎ |
klicker-uzh Run #2947
Run Properties:
|
Project |
klicker-uzh
|
Branch Review |
v3
|
Run status |
Failed #2947
|
Run duration | 09m 24s |
Commit |
2cb5d110f6: enhance(apps/frontend-manage): limit group activity creation to courses where gr...
|
Committer | Julius Schlapbach |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
1
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
42
|
View all changes introduced in this branch ↗︎ |
Tests for review
cypress/e2e/K-group-activity-workflow.cy.ts • 1 failed test
Test | Artifacts | |
---|---|---|
Create and solve a group activity > create a group activity and edit it |
Screenshots
|
No description provided.