https://avo.cool logo
hey guys - question unrelated to avo:
# general
n
hey guys - question unrelated to avo: have any one ever built a user calendar with repeating events ? if yes, how did you handle occurencies ? how did you handle updating an event vs updating the parent event's occurences ? what happens if you have invited someone to the event and then deleted it ? should you send him to the next event or what ? thanks 🙏
l
I never built anything like that
- I would do some research with folks that built it. not necesarrily deep technical dives, but hear them how they talk about that problem
- next I would try to find an open-source project that handles that and see how they built it
- I would also play around with the calendar. try to reverse engineer it aand see if they schedule tasks for the next x days/months/years and add another record when the time is gettting close to expire... or what
I don't have a clear approach. maybe hold some state around parent/child realtionship between events. > should you send him to the next event or what this is something that you should ask the stakeholder IMHO. see what their needs are
f
I have built one back in 2020 using https://fullcalendar.io/ with version 4. Now its V6. Please take a look
n
thanks for this, but this is only UI - I need more logic than UI
100% - this is what I'm trying to do 😂 that's why I asked here to see if anyone has ever done anything like this
it's super complicated when it comes to people attending an event - and how many instances you should build in the future, etc etc...
f
https://fullcalendar.io/docs/recurring-events this page has lots of details about recurring events.
Copy code
ruby
# Event
  field :name, type: String
  field :starting_date, type: DateTime
  field :ending_date, type: DateTime
  field :start_time, type: DateTime
  field :end_time, type: DateTime
  field :duration, type: Integer # in sec
  field :days_of_week, type: Array
  
  belongs_to :creator, class_name: 'User'
  has_many :event_invites, dependent: :destroy
  has_many :invited_users, through: :event_invites, source: :user

# user
  #other fields
  has_many :created_events, class_name: 'Event', foreign_key: 'creator_id', dependent: :destroy
  has_many :event_invites, dependent: :destroy
  has_many :invited_events, through: :event_invites, source: :event

# EventInvite
  belongs_to :user
  belongs_to :event
This way we don't have to create multiple events. with 1 event we can manage most of things. For me: I updated the same event for new invite or removing any existing user from the event. but there can be some scenarios to duplicate the event with little tweaks with range, day of week.
l
this sounds like a collab happening here. Maybe you two wanna team up or share some knowledge?
n
just sent you a Friend Request - let's continue the chat there, and then we can share the knowledge here at the end 🤝