Skip to content
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

Remove duplicate tracking (KIDS-1465) #1148

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

MaikelStuivenberg
Copy link
Contributor

@MaikelStuivenberg MaikelStuivenberg commented Oct 9, 2024

Summary by CodeRabbit

  • New Features
    • Added a new analytics event for confirming preferred church selection, enhancing user interaction tracking.
  • Bug Fixes
    • Streamlined logging by removing outdated properties, improving clarity in event tracking.
  • Refactor
    • Updated parameters for analytics events to enhance data accuracy and relevance.

@MaikelStuivenberg MaikelStuivenberg requested a review from a team as a code owner October 9, 2024 13:56
@github-actions github-actions bot added the bug Something isn't working label Oct 9, 2024
Copy link
Contributor

coderabbitai bot commented Oct 9, 2024

Walkthrough

The changes in this pull request introduce a new enumeration value to the AmplitudeEvents enum and modify the PreferredChurchSelectionPage class in the preferred_church_selection_page.dart file. The new enum value, preferredChurchConfirmClicked, is added to track user interactions related to confirming a preferred church. Additionally, the class updates include changes to the AnalyticsEvent constructor parameters and the logging of analytics events to reflect the new naming conventions.

Changes

File Path Change Summary
lib/core/enums/amplitude_events.dart - Added enum value preferredChurchConfirmClicked('preferred_church_clicked') to AmplitudeEvents.
lib/features/family/features/preferred_church/... - Updated PreferredChurchSelectionPage to use namespace and orgname in AnalyticsEvent constructor.
- Renamed analytics event from AmplitudeEvents.preferredChurchSelected to AmplitudeEvents.preferredChurchConfirmClicked.
- Replaced churchId with churchNamespace in logging and method calls.

Assessment against linked issues

Objective Addressed Explanation
Include church in Amplitude tracking when setting your preferred church (KIDS-1465)

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • Daniela510
  • TammiLion

Poem

🐰 In the land of choices, we hop and play,
With buttons that sparkle, guiding our way.
Analytics now dances, with data in tow,
Preferred churches chosen, as we joyfully go! 🌟


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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)
lib/features/family/features/preferred_church/preferred_church_selection_page.dart (1)

127-131: Approve changes with a suggestion for improved robustness

The addition of namespace and orgname parameters to the AnalyticsEvent constructor aligns well with the PR objective of including church data in Amplitude tracking when users set their preferred church. This change enhances the tracking accuracy as requested.

However, to improve robustness, consider adding a safety check:

Consider adding a null check or boundary check before accessing filteredOrganisations[selectedIndex] to prevent potential runtime errors. Here's a suggested implementation:

 analyticsEvent: AnalyticsEvent(
   AmplitudeEvents.preferredChurchSelected,
   parameters: {
-    'namespace':
-        bloc.state.filteredOrganisations[selectedIndex].nameSpace,
-    'orgname': bloc.state.filteredOrganisations[selectedIndex].orgName,
+    if (selectedIndex >= 0 && selectedIndex < bloc.state.filteredOrganisations.length) ...{
+      'namespace': bloc.state.filteredOrganisations[selectedIndex].nameSpace,
+      'orgname': bloc.state.filteredOrganisations[selectedIndex].orgName,
+    },
   },
 ),

This change ensures that the analytics event is still created even if there's an issue with the selectedIndex, preventing potential crashes while maintaining data integrity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between acb8ad5 and 857b761.

📒 Files selected for processing (1)
  • lib/features/family/features/preferred_church/preferred_church_selection_page.dart (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
lib/features/family/features/preferred_church/preferred_church_selection_page.dart (2)

Line range hint 135-172: Approve removal of redundant analytics logging

The removal of the analytics event logging from the _onTapConfirm method is appropriate and aligns with the PR objective of removing duplicate tracking. This change consolidates the analytics tracking to a single point in the floatingActionButton, which is a cleaner and more maintainable approach.

The core functionality of setting the preferred church and displaying the appropriate dialogs remains intact, ensuring that the user experience is not affected by this change.


Line range hint 1-172: Summary: Changes successfully address PR objectives

The modifications in this file effectively address the PR objectives by:

  1. Removing duplicate tracking of analytics events.
  2. Including church data (namespace and organization name) in Amplitude tracking when users select their preferred church.

The changes are well-implemented and maintain the overall functionality of the PreferredChurchSelectionPage. The consolidation of analytics tracking to the floatingActionButton improves code maintainability.

A minor suggestion was made to enhance robustness when accessing the selected organization's data. Overall, the changes are approved and align well with the intended goals of the PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (2)
lib/core/enums/amplitude_events.dart (2)

282-282: LGTM with a minor suggestion for consistency

The addition of preferredChurchConfirmClicked aligns well with the PR objectives of including church data in Amplitude tracking and removing duplicate tracking. The placement and naming convention are appropriate.

Consider updating the event value to match the enum name more closely:

-  preferredChurchConfirmClicked('preferred_church_clicked'),
+  preferredChurchConfirmClicked('preferred_church_confirm_clicked'),

This change would maintain consistency with the enum name and provide more precise tracking information.


Line range hint 1-382: Consider restructuring the AmplitudeEvents enum for improved maintainability

While the current implementation works, the large number of events in a single enum might lead to maintainability issues as the application grows. Consider the following suggestions to improve the structure:

  1. Group related events into separate enums or use a nested enum structure if supported by your version of Dart.
  2. Consistently use comments to separate different groups of events.
  3. Consider using a prefix naming convention for different types of events (e.g., userAction, systemEvent, errorEvent).

Here's an example of how you might restructure a portion of the enum:

enum AmplitudeEvents {
  // User Actions
  userActionLetsGo('user_action_lets_go'),
  userActionLoginClicked('user_action_login_clicked'),
  // ... other user actions

  // System Events
  systemEventAccountLocked('system_event_account_locked'),
  systemEventWalletTracker('system_event_wallet_tracker'),
  // ... other system events

  // Error Events
  errorEventTopupFailed('error_event_topup_failed'),
  errorEventFailedToCreateMember('error_event_failed_to_create_member'),
  // ... other error events

  // Registration Flow
  registrationContinueByEmailSignUpNewUserClicked('registration_continue_by_email_sign_up_new_user_clicked'),
  registrationContinueByEmailSignUpTempUserClicked('registration_continue_by_email_sign_up_temp_user_clicked'),
  // ... other registration events

  // ... other event categories
}

This structure would make it easier to locate and add new events, as well as understand the purpose of each event at a glance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 857b761 and 43413e5.

📒 Files selected for processing (2)
  • lib/core/enums/amplitude_events.dart (1 hunks)
  • lib/features/family/features/preferred_church/preferred_church_selection_page.dart (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/features/family/features/preferred_church/preferred_church_selection_page.dart
🧰 Additional context used
🔇 Additional comments (1)
lib/core/enums/amplitude_events.dart (1)

Line range hint 1-382: Summary of review for AmplitudeEvents enum

  1. The addition of preferredChurchConfirmClicked has been approved with a minor suggestion for the event value.
  2. A recommendation for restructuring the enum for better maintainability has been provided.
  3. The changes align with the PR objectives of including church data in Amplitude tracking and removing duplicate tracking.

Overall, the changes look good and contribute to improving the tracking system as intended.

@TammiLion TammiLion merged commit b347c88 into develop Oct 10, 2024
1 check passed
@TammiLion TammiLion deleted the bug/kids-1465-remove-duplicate-tracking branch October 10, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants