Skip to content

Send an email on the start date of the camp#318

Merged
tarunnjoshi merged 2 commits intodevelopfrom
send-logistics-email-on-start-date
Oct 3, 2024
Merged

Send an email on the start date of the camp#318
tarunnjoshi merged 2 commits intodevelopfrom
send-logistics-email-on-start-date

Conversation

@tarunnjoshi
Copy link
Copy Markdown
Member

@tarunnjoshi tarunnjoshi commented Oct 3, 2024

Send an email on the start date of the camp

Summary by CodeRabbit

  • New Features

    • Updated email notifications for collection camps to trigger based on the start date instead of the end date, improving the timing of participant communications.
  • Bug Fixes

    • Corrected date logic to ensure accurate comparisons for camp notifications.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 3, 2024

Walkthrough

The changes in this pull request modify the civicrm_api3_goonjcustom_collection_camp_cron function within the CollectionCampCron.php file. The updates focus on the date-related logic by replacing references from End_Date to Start_Date in multiple instances. This includes adjustments in field selection from the EckEntity query and the conditions for triggering email notifications, ensuring that notifications are sent based on the start date of collection camps.

Changes

File Path Change Summary
wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/CollectionCampCron.php Modified date logic in civicrm_api3_goonjcustom_collection_camp_cron to use Start_Date instead of End_Date in field selection, condition checks, and DateTime instantiation. Updated email subject for notifications.

Possibly related PRs

  • Updated Mail Id for Collection Camp #300: This PR modifies the civicrm_api3_goonjcustom_collection_camp_cron function in the same CollectionCampCron.php file, focusing on email sender information, which is related to the notification changes in the main PR.
  • Seperate the cron for feedback and logistics #309: This PR also alters the civicrm_api3_goonjcustom_collection_camp_cron function, specifically removing feedback email handling, which is relevant to the notification logic in the main PR.
  • Change the type of custom field #319: This PR changes the URL construction in the goonjcustom_collection_camp_email_html function, which is related to the notification process and URL parameters in the main PR.

Suggested reviewers

  • pokhiii

🐇 In the fields where the campfires glow,
The start dates now take center stage, you know!
With emails sent at the right time,
Our bunnies hop with joy, oh so sublime!
So let the notifications ring,
For every camp, let the good news spring! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 04f16ea and 9ab34a3.

📒 Files selected for processing (1)
  • wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/CollectionCampCron.php (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/CollectionCampCron.php

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.

@tarunnjoshi tarunnjoshi requested a review from pokhiii October 3, 2024 04:44
@tarunnjoshi tarunnjoshi self-assigned this Oct 3, 2024
Copy link
Copy Markdown

@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)
wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/CollectionCampCron.php (2)

95-95: Update email content to reflect start of camp

The change to use startDateFormatted in the condition for sending the email is correct and aligns with the PR objective. However, the email is still referred to as a "Completion Notification" in the subject line (line 108). Consider updating the email content to reflect that it's being sent at the start of the camp rather than at completion.

Suggested change for line 108:

- 'subject' => 'Collection Camp Completion Notification: ' . $campCode . ' at ' . $campAddress,
+ 'subject' => 'Collection Camp Start Notification: ' . $campCode . ' at ' . $campAddress,

Also, consider updating the email body content in the goonjcustom_collection_camp_email_html function to reflect that the camp is starting rather than completing.


Line range hint 1-158: Overall implementation looks good, minor content update needed

The changes consistently implement the switch from using the end date to the start date for camp-related operations, meeting the PR objective of sending an email on the start date of the camp. However, the email content still refers to camp completion, which should be updated to reflect that it's being sent at the start of the camp.

Please update the email content in the goonjcustom_collection_camp_email_html function to reflect that the camp is starting rather than completing. This will ensure consistency with the new behavior of sending the email at the start of the camp.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6ecfc91 and 04f16ea.

📒 Files selected for processing (1)
  • wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/CollectionCampCron.php (3 hunks)
🔇 Additional comments (3)
wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/CollectionCampCron.php (3)

53-53: LGTM: Updated field selection to use start date

The change from 'Collection_Camp_Intent_Details.End_Date' to 'Collection_Camp_Intent_Details.Start_Date' aligns with the PR objective to send an email on the start date of the camp.


56-56: LGTM: Updated selection criteria to use start date

The change to use 'Collection_Camp_Intent_Details.Start_Date' in the where clause is consistent with the PR objective and ensures that camps are selected based on their start date.


66-68: LGTM: Updated date handling to use start date

The changes to use the start date for creating the DateTime object and introducing startDateFormatted are consistent with the PR objective and previous modifications. This allows for proper comparison with the current date later in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants