Replies: 1 comment
-
Hey @paulsizer! I just stumbled upon your issue and I hope this is still relevant! Your problem sounds like a race-condition to me. Nothing in your code prevents running Maybe, locking the around_deliver :with_locked_coach
def with_locked_coach(&block)
workout = Workout.find(params[:workout][:id])
workout.client.coach.with_lock(&block)
end However, it would probably be better to perform this check before calling |
Beta Was this translation helpful? Give feedback.
-
We use noticed to show the end user (coach) a list of notifications they have received from their clients.
I have an action that allows a client to complete a workout, once the workout is completed I create a notification.
WorkoutNotification.with(workout: @workout, sender: session_user.client).deliver_later(@workout.client.coach)
Inside the notification I have:
deliver_by :database, if: :should_send?
notification_enabled just checks the coaches settings to see if they allow those type of notifications.
Some users complain they are receiving multiple notifications for the same thing. I have tried to replicate this by creating a loop in the console and creating multiple notifications with the same params and it only ever creates 1.
Should I do a check outside of the WorkoutNotification class?
Beta Was this translation helpful? Give feedback.
All reactions