codefog / contao-events_subscriptions

Contao extension that allows members of your website to subscribe to the events
MIT License
10 stars 5 forks source link

Loading times "My Subscriptions" pretty long #76

Closed Kahmoon closed 3 years ago

Kahmoon commented 3 years ago

Hi Kamil,

can we boost "my subscriptions" in any way? For a casual student with not that many events subscribed (in this case 36 events from 3 archives) the page is loading 8-10 seconds which is insanely long :-(. He will probably subscribe to round about 20 more. Maybe some kind of caching!?

Bildschirmfoto 2021-10-11 um 13 09 50 Bildschirmfoto 2021-10-11 um 13 12 25
qzminski commented 3 years ago

Hey, can you send me your database SQL dump over the e-mail? You already know it 😉

Kahmoon commented 3 years ago

You already know it 😉

?? Yo mean this come from latest changes? Its not since the latest changes but maybe this made it a bit worse.

Actually there are round about 20 calendar archives für different. Probably the query goes over every archive.

I will send a dump

qzminski commented 3 years ago

By "it" I meant my e-mail address, sorry.

Kahmoon commented 3 years ago

Haha OK. E-mail should be there already

Kahmoon commented 3 years ago

I removed some old archives ( < 2019 ) but still 23 left. Every archive contains round about 60-80 events. Just "Alle Kurse" contains 769 and "Prüfungsvorbereitung" 598, which most of them are offline.

Bildschirmfoto 2021-10-11 um 16 05 55
qzminski commented 3 years ago

I have found the biggest bottleneck, please update the extension to 2.13.2 and the performance should be better.

Kahmoon commented 3 years ago

Performance went super up…but also the preview of subscribers is 0 now.

Kahmoon commented 3 years ago
Bildschirmfoto 2021-10-13 um 13 17 39

$this->subscribers does not exist anymore. Also $this->subscriptionMaximum

event_upcoming template


<div class="event layout_upcoming subscriptions <?= $this->classUpcoming ?><?php if (count($cssClasses) > 0): ?> <?= implode(' ', $cssClasses); endif; ?>">

    <time datetime="<?= $this->datetime ?>" class="date" itemprop="startDate">
    <i class="fas fa-calendar-check <?= $this->classUpcoming ?>"></i> <?= $this->date ?><?php if ($this->time): ?> <span class="">(<?= $this->time ?> Uhr)</span><?php endif; ?>

    <?php if($this->subscribers['subscriptionMaximum'] != 999) :?>

    <span class="subscribers_status_upcoming primary" title="<?php if(strstr($this->classUpcoming,'can-subscribe')): ?>Anmeldung für diesen Termin möglich.<?php else: ?>Keine Anmeldung für diesen Termin möglich.<?php endif; ?>">({{fa::user}} <?php if($this->subscribers['subscribersParticipants'] > 0):?><?= $this->subscribers['subscribersParticipants'] ?><?php else:?>0<?php endif; ?>/<?php if($this->subscriptionMaximum != 0): ?><?= $this->subscriptionMaximum ?><?php else: ?>&#8734;<?php endif; ?>):</span>
    <?php endif; ?>

    <span class="d-sm-none d-xs-inline">
        <?php if(strstr($this->classUpcoming,'subscribed')): ?>
            {{fa::star}}
        <?php endif; ?>
    </span>
  </time>

  <a class="d-block d-lg-inline" href="<?= $this->href ?>" title="<?= $this->title ?> (<?php if ($this->day) echo $this->day . ', '; ?><?= $this->date ?><?php if ($this->time) echo ', ' . $this->time;?> Uhr)"<?= $this->target ?> itemprop="url"><?= $this->link ?></a>

    <span class="d-none d-sm-inline">
        <?php if(strstr($this->classUpcoming,'subscribed')): ?>
            {{fa::star}}
        <?php endif; ?>
    </span>
</div>```
qzminski commented 3 years ago

I forgot that you also use other calendar extensions, please try updating to 2.13.3.

Kahmoon commented 3 years ago

Thanks. Problem is fixed in cal_default but not event_upcoming template

Variables used in event_upcoming template see post above. https://github.com/codefog/contao-events_subscriptions/issues/76#issuecomment-942172002

Bildschirmfoto 2021-10-13 um 13 27 16 Bildschirmfoto 2021-10-13 um 13 27 28
qzminski commented 3 years ago

What module type is that? Event list?

Kahmoon commented 3 years ago

yes. it worked before 2.13.2

Bildschirmfoto 2021-10-13 um 13 41 04 Bildschirmfoto 2021-10-13 um 13 35 51
qzminski commented 3 years ago

It did work before, because it used the getAllEvents hook to add the data to the event, but that solution fails due to performance issues. And it would still work, if you wouldn't have the https://packagist.org/packages/kmielke/calendar-extended-bundle installed in your system, which overrides the event list module.

I will send you your updated custom module soon via e-mail.

Kahmoon commented 3 years ago

I´m not sure if i need this module mandatory. I will check

qzminski commented 3 years ago

Just a little update: after changes in this commit, the fact that kmielke/calendar-extended-bundle overrides the core module is irrelevant. The subscribers data won't be available in core modules either. To get the subscribers data inside the events module, please use the Event list subscribe and Event reader subscribe modules.

Kahmoon commented 3 years ago

So it would be no problem anyways?

I just tried in dev system and it seems that we don´t need this extension anyway

Edit: I removed this extension. We used a single field....thats not woth a complete extension

Kahmoon commented 3 years ago

Your new listing module is fine. Performance too. Thanks a lot!