codebar / planner

🗓 the main codebar site
https://codebar.io
MIT License
92 stars 193 forks source link

Events page displays every event #536

Closed dondonz closed 7 years ago

dondonz commented 7 years ago

The Events page currently displays every Codebar event held in the past. I think it's good to list past events, as it's a great indicator of the quality & regularity of Codebar's workshops.

As the number of workshops is growing at an ever faster rate, I'd like to limit the number of workshops shown on the Events page and reduce the size of the DB request.

What do you think about only loading the most recent 20/30 events and then end with a bit of text saying "and 189 other workshops since 2013"? I'm open to suggestions - if you'd prefer to still see all the events, we could have pagination instead.

I'm happy to look after this ticket.

matyikriszta commented 7 years ago

That sounds good @dondonz, I'm happy to display the last 30 events only and then a number at the end that says however many workshops in total (for workshops and maybe Monthlies?)

BPScott commented 7 years ago

There is a headache here where events are stored in across multiple tables, so it becomes a bit fiddly to request "the last 30 of any event type". You'd probably need to request the last 30 of every type of event from the DB, munge them into one array, order that array, then throw away the everything that wasn't in the top 30.

Better long-term plan would be creating an "event" table that can store the multiple types of event, buts that's very drastic and requires a heck of a lot of DB reworking. Your plan is a really solid stopgap to speed up the the events page which is now getting pretty unmanageable.

dondonz commented 7 years ago

Thanks @BPScott - I wasn't aware of that! Well this got quite a bit more interesting...!

Ahh I agree it would be much better to have 1 table for all events. For now, I'll rework the page to display the last 30 of any event type. Let's see how fast it is... at the moment the load time is about 5 seconds.

matyikriszta commented 7 years ago

A sort of solution to this has been submitted in #551. Closing this issue.