Fix cache not generating

This commit is contained in:
Jay Trees 2022-03-23 12:36:06 +01:00
parent 06b474580f
commit 09d861975e
2 changed files with 5 additions and 5 deletions

View file

@ -83,7 +83,7 @@ $(function () {
/** /**
* Generate cache * Generate cache
*/ */
var cards = $('.ui.card[data-cache="false"]'); var cards = $('.ui.card[data-cache="true"]');
if (cards.length > 0) { if (cards.length > 0) {
progress.slideDown(); progress.slideDown();
@ -101,7 +101,7 @@ $(function () {
var timerInterval = 1200; var timerInterval = 1200;
var timerCache = setTimeout( var timerCache = setTimeout(
function generateCacheCards() { function generateCacheCards() {
var cards = $('.ui.card[data-cache="false"]'); var cards = $('.ui.card[data-cache="true"]');
cards.each(function (index, card) { cards.each(function (index, card) {
generateCacheCard($(card)); generateCacheCard($(card));
@ -137,7 +137,7 @@ $(function () {
} }
card.addClass('loading'); card.addClass('loading');
card.attr('data-cache', true); card.attr('data-cache', false);
var wishlistIndex = $('.ui.dropdown.wishlists select').prop('selectedIndex') - 1; var wishlistIndex = $('.ui.dropdown.wishlists select').prop('selectedIndex') - 1;
var wishlist_user = wishlists[wishlistIndex].user; var wishlist_user = wishlists[wishlistIndex].user;
@ -148,7 +148,7 @@ $(function () {
.then(handleFetchError) .then(handleFetchError)
.then(handleFetchResponse) .then(handleFetchResponse)
.then(function(response) { .then(function(response) {
card.replaceWith(response.html.replace('data-cache="false"', 'data-cache="true"')); card.replaceWith(response.html.replace('data-cache="true"', 'data-cache="false"'));
}) })
.catch(handleFetchCatch) .catch(handleFetchCatch)
.finally(function() { .finally(function() {

View file

@ -127,6 +127,6 @@ class EmbedCache
public function generateCache(): bool public function generateCache(): bool
{ {
return !$this->exists() return !$this->exists()
|| ($this->exists() && $this->age() <= $this->maxAge()); || ($this->exists() && $this->age() > $this->maxAge());
} }
} }