Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hello,

I really need help with this one.
(can be a paid job if needed)

I am using Fullcalendar to display a bunch of entries as events.
The way the whole CRM has been coded, the events that must be displayed are Repeatable regions.
The main clonable page is "contracts". And inside a contract, I can add multiple events using repeatable regions.

Everything works fine the way I have coded it, except that since I'm using repeatable regions (and for now there's no way to change it for something else), Couch fetches ALL contracts (I've added a parameter in the masterpage section to get only the contracts from 18 months and earlier), and THEN, places all the events. So it takes around 10 seconds for the page to load.

I need to find a way to fetch the events from ALL contracts, but actually display and load in the ones within the selected month in Fullcalendar.

For example, if the page loads on March 2021 (I have set it to load on the current month), I need it to display all the contracts that have dates in the repeatable regions from that current month only. And then if I change month, it should loads the other month only. In short, being able to load one month at a time, but not by using the publish_date variable, since the dates are in repeatable regions. Some contracts have multiple events (multiple rows in the "event_details" repeatable region).

I know it's far from optimal to use Repeatable regions for that, but that's the way it has been coded few years ago and I have to work with that for now.

I thought of using couch search system too. It's ok if I'm not using Fullcalendar.
All I need, is to display a list of events, per days.
Right now it looks like this, and this is the kind of format I must keep (a table header with the date, followed by the events for that date, and so on).
Image

If I can make something like this without Fullcalendar, just by using Couch functions, it would be fine too.

Thank you very much
Today is an interesting day.. Somehow Couch made it to my schedule through various activities and now I have something to say about your post. I don't have a solution and will only share thoughts.

Second part of the solution (and less important) will be presentation - FullCalendar or DataTables or whatever, you decide what's best looking. The first part is the data, the underlying pipeline, the engineering problem that does not allow fancy stuff to happen. Data must be pre-cached - made available for all your needs with instant access.

Repeatables are great but not optimal (you said it too), because they are kept packed in db (because of reasons). However they are awesome looking and easy to click through. What you can do is create a switch in your head and, when needed, think of backend not only as a tool to be used by admin, but also a storage for your data to comfortably navigate it programmatically.

If Admin saves a page with repeatables - make a cache for your most crucial operations, create a copy of the data in such form (form depends on who you'd ask) that will be easy to navigate programmatically (fetch and filter). A hidden template with cloned pages, page per repeatable? Sure. A separate table in database to hold events in most usable schema? Nice and fast. A hidden textarea on contract page with a copy of each event per row in your special format (which quickly can be parsed into array)? Could work. Just have it at hands the way (any! way) you can handle.

Once the underground foundation is laid, you are free to use any presenational frontend part with almost instant loading (even if there are thousands of events).
Thanks Anton.

Very interesting and informative post.

So if I understand correctly, a text area with the text (for example) :

Code: Select all
Test1
Test2
Test3


Would be fetched faster than :

Code: Select all
<cms:show_repeatable 'test_region'>
<cms:show test_number/><br>
</cms:show_repeatable>


Correct?

I have easily added a textarea region and edited the form "success" part with some db_persist to copy the data from the repeatable region in that new textarea region. It works very well.

Does it sound like a good solution to display events in the calendar based off that new textarea region instead of using "<cms:show_repeatable>..." ?

Thanks again for your insight
Technical questions are a dessert that I put forward after the main course is served) First think through means to aggregate complex data in such manner (and keep it wherever comfortable) that it will be as fewest ops neeed as possible to request aggregated data than fetch entries separately aggregating them in real time. Maybe you will have several textareas for events in different years.. You should not miss the point - we are not just copypasting data somewhere else. There is no speed gain in getting a single value from either of fields. The speed gain comes from not making complex queries in real time, but precalculate-precache-prepare (at least partially, where possible) what you can do. That's it (my final post in this thread). :)
4 posts Page 1 of 1