I have a notifications table where I email out reports to people based on the frequency they've selected.
If an email address exists across multiple questions and has the same frequency...then I need to group them together so I can send one report for both questions.
[
#<Notification id: 1, question_id: 58, email: "[email protected]", frequency: "daily">,
#<Notification id: 2, question_id: 25, email: "[email protected]", frequency: "daily">,
#<Notification id: 3, question_id: 47, email: "[email protected]", frequency: "monthly">,
#<Notification id: 3, question_id: 19, email: "[email protected]", frequency: "monthly">
]
So in my example data, 3 reports would be sent:
- 1 to [email protected] for question's 58 and 25 on a daily basis
- 1 to [email protected] for question 47 on a monthly basis
- 1 to [email protected] for question 19 on a monthly basis
I may not be explaining this very well, so let me know if something needs clarification.
notificationfit with your other models?