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

Added user notifications #401

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Added user notifications #401

wants to merge 2 commits into from

Conversation

Coder-Srinivas
Copy link
Contributor

  • Send a welcome mail to users when they finish their first study
  • Send an email to users when a new study becomes available
  • Send an email to users when a new learning path becomes available
  • Send an email to inactive users, (when they are inactive for more than 60 days and an email hasn't been sent already)

@@ -5,6 +5,9 @@ class Api::V1::Participant::StudiesController < Api::V1::BaseController
before_action :set_study, only: [:launch, :land, :stats]

def index
current_user_preference = UserPreferences.find_or_initialize_by(user_id: current_user.id)
current_user_preference.update!(last_visited_at: Time.current, nurturing_email_sent: false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to reset the nurturing_email_sent every time they load the studies page? just checking :)

@@ -37,7 +37,9 @@ def deliver_new_studies
return unless users.any?

users.each_value do |user|
UserMailer.with(user:, studies:).new_studies.deliver
studies.each do |study|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with looping over each study, would we be emailing user A for every new study? ie would they get 5 emails if there were 5 new studies? is that what we want?


selected_learning_path = LearningPath
.where.not(id: initiated_learning_path_ids)
.order('RANDOM()')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious about this RANDOM() here 😄

Comment on lines +36 to +40
user_info = UserInfo.for_uuid(user_id)
recipient = Struct.new(:email_address, :full_name).new(
user_info['email_address'] || '[email protected]',
user_info[:full_name]
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this can be moved below the return unless since we don't use it if that condition is met 🤔 not a big deal at all though

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