HaikuArchives / Calendar

:calendar: A native Calendar application for Haiku.
MIT License
29 stars 20 forks source link

Querying the DB for next events #128

Closed harshit-sharma-gits closed 1 year ago

harshit-sharma-gits commented 1 year ago

For issue: #122

The scope of this PR: To get the events-to-be-reminded in fEventList and manage it by adding/removing the events as per the requirement.

harshit-sharma-gits commented 1 year ago

This commit is not complete yet. Currently, it only fetches the list from QueryDBManager and add events to the list when an event is added.

I am working on the attribute change and event removing.

harshit-sharma-gits commented 1 year ago

I do want to make clear that I will not approve a design where every individual node is going to be watched. This is not scalable. Even if it works for a little test data, you are going to run into limits if someone seriously uses the application.

Yes, we can leave this (the attribute part) for now with a note to work on this post GSoC (as I stated in the mail)

I also don't really understand how this is supposed to work. There is an fEventList. You manually add things there, but you initialize it using a function in the QueryDBManager... Can you explain how it is supposed to work? What triggers changes? How will you determine what events to notify for next?

QueryDBManager::GetEventsToNotify() fetches a list of event that are to be reminded, so I am using this to get the events list instead of making a function for it myself (code re-use). The changes are triggered by Node Monitor, which we are using on the events directory. That is, if any entry is created/removed from the events directory, it triggers the daemon to "refresh" the events list.

The idea is to get the events list when the daemon is started and then node monitor the events directory to get the updates (adding/removing) which we can manually add/remove to/from the fEventList. What we can alternately do is, in any case (event adding/removing) we can fetch for a fresh list of the events with the fDBManager->GetEventsToNotify() and update the fEventList. Would that be better option?

nielx commented 1 year ago

For issue: https://github.com/HaikuArchives/Calendar/issues/122

The scope of this PR: To get the events-to-be-reminded in fEventList and manage it by adding/removing the events as per the requirement.