From 0a27e91de75872852e784e9656debacd31b7cad1 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 2 Jul 2023 22:21:19 +0200 Subject: [PATCH] Using effective date in all queries. --- assets/js/actors/actions.js | 25 ++++------------------- assets/js/fragments.js | 37 +---------------------------------- assets/js/networks/actions.js | 27 +++++++------------------ assets/js/sites/actions.js | 10 +++++----- assets/js/tags/actions.js | 2 +- 5 files changed, 18 insertions(+), 83 deletions(-) diff --git a/assets/js/actors/actions.js b/assets/js/actors/actions.js index 7b630cdf..b5eae9f8 100755 --- a/assets/js/actors/actions.js +++ b/assets/js/actors/actions.js @@ -37,8 +37,6 @@ function initActorActions(store, router) { $offset:Int = 0, $after:Datetime = "1900-01-01", $before:Datetime = "2100-01-01", - $afterTime:Datetime = "1900-01-01", - $beforeTime:Datetime = "2100-01-01", $orderBy:[ReleasesOrderBy!] $selectableTags: [String], $includedTags: [String!], @@ -206,23 +204,10 @@ function initActorActions(store, router) { } scenesConnection( filter: { - or: [ - { - date: { - lessThan: $before, - greaterThan: $after - } - }, - { - date: { - isNull: true - }, - createdAt: { - lessThan: $beforeTime, - greaterThan: $afterTime, - } - } - ] + effectiveDate: { + lessThan: $before, + greaterThan: $after + } and: [ { or: $includedEntities @@ -264,8 +249,6 @@ function initActorActions(store, router) { offset: Math.max(0, (pageNumber - 1)) * limit, after, before, - afterTime: store.getters.after, - beforeTime: store.getters.before, selectableTags: config.selectableTags, orderBy, exclude: store.state.ui.tagFilter, diff --git a/assets/js/fragments.js b/assets/js/fragments.js index 97f8f204..dd14d70a 100755 --- a/assets/js/fragments.js +++ b/assets/js/fragments.js @@ -419,7 +419,7 @@ const releasesFragment = ` connection: releasesConnection( filter: { releasesNotShowcasedsConnectionExist: false - date: { + effectiveDate: { lessThan: $before, greaterThan: $after } @@ -444,40 +444,6 @@ const releasesFragment = ` } `; -// unused due performance -const releasesShowcasedFragment = ` - connection: releasesShowcasedsConnection( - filter: { - release: { - date: { - lessThan: $before, - greaterThan: $after - } - releasesTagsConnection: { - none: { - tag: { - or: [ - { slug: { in: $exclude } } - { name: { in: $exclude } } - ] - } - } - } - } - }, - first: $limit, - offset: $offset, - orderBy: $orderBy - ) { - releases: nodes { - release { - ${releaseFields} - } - } - totalCount - } -`; - const mediaFields = ` id index @@ -715,7 +681,6 @@ export { releasePhotosFragment, releaseTrailerFragment, releasesFragment, - releasesShowcasedFragment, releaseFragment, siteFragment, sitesFragment, diff --git a/assets/js/networks/actions.js b/assets/js/networks/actions.js index d2e9fcf5..9166e726 100755 --- a/assets/js/networks/actions.js +++ b/assets/js/networks/actions.js @@ -1,7 +1,7 @@ import { graphql } from '../api'; // import { sitesFragment, releaseFields } from '../fragments'; import { releaseFields } from '../fragments'; -import { curateNetwork } from '../curate'; +import { curateEntity } from '../curate'; import getDateRange from '../get-date-range'; function initNetworksActions(store, _router) { @@ -59,23 +59,10 @@ function initNetworksActions(store, _router) { { parent: { parent: { slug: { equalTo: $networkSlug } } } } ] } - or: [ - { - date: { - lessThan: $before, - greaterThan: $after - } - }, - { - date: { - isNull: true - }, - createdAt: { - lessThan: $beforeTime, - greaterThan: $afterTime, - } - } - ] + effectiveDate: { + lessThan: $before, + greaterThan: $after + } releasesTagsConnection: { none: { tag: { @@ -106,7 +93,7 @@ function initNetworksActions(store, _router) { }); return { - network: curateNetwork(network, releases), + network: curateEntity(network, releases), totalCount, }; } @@ -131,7 +118,7 @@ function initNetworksActions(store, _router) { } `); - return networks.map(network => curateNetwork(network)); + return networks.map((network) => curateEntity(network)); } return { diff --git a/assets/js/sites/actions.js b/assets/js/sites/actions.js index 6fe7a0a5..70d6c7e2 100755 --- a/assets/js/sites/actions.js +++ b/assets/js/sites/actions.js @@ -1,6 +1,6 @@ import { graphql } from '../api'; import { releaseFields } from '../fragments'; -import { curateSite, curateRelease } from '../curate'; +import { curateEntity, curateRelease } from '../curate'; import getDateRange from '../get-date-range'; function initSitesActions(store, _router) { @@ -41,7 +41,7 @@ function initSitesActions(store, _router) { } releasesConnection( filter: { - date: { + effectiveDate: { lessThan: $before, greaterThan: $after, }, @@ -75,7 +75,7 @@ function initSitesActions(store, _router) { equalTo: $siteSlug } } - date: { + effectiveDate: { lessThan: $before, greaterThan: $after } @@ -107,8 +107,8 @@ function initSitesActions(store, _router) { }); return { - site: curateSite(site), - releases: releases.map(release => curateRelease(release)), + site: curateEntity(site), + releases: releases.map((release) => curateRelease(release)), totalCount, }; } diff --git a/assets/js/tags/actions.js b/assets/js/tags/actions.js index d9ee2cda..425b8b90 100755 --- a/assets/js/tags/actions.js +++ b/assets/js/tags/actions.js @@ -157,7 +157,7 @@ function initTagsActions(store, _router) { } scenesConnection( filter: { - date: { + effectiveDate: { lessThan: $before, greaterThan: $after, },