-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: main
Are you sure you want to change the base?
Conversation
Coder-Srinivas
commented
Jan 13, 2025
- 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) |
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.
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| |
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.
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()') |
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.
just curious about this RANDOM() here 😄
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] | ||
) |
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.
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