diff --git a/assets/js/get-date-range.js b/assets/js/get-date-range.js index 573395bb..83806344 100644 --- a/assets/js/get-date-range.js +++ b/assets/js/get-date-range.js @@ -5,23 +5,23 @@ dayjs.extend(utc); const dateRanges = { latest: () => ({ - after: '1900-01-01 00:00:00', - before: dayjs.utc().format('YYYY-MM-DD HH:mm:ss'), + after: '1900-01-01', + before: dayjs.utc().toDate(), orderBy: 'DATE_DESC', }), upcoming: () => ({ - after: dayjs.utc().format('YYYY-MM-DD HH:mm:ss'), - before: '2100-01-01 00:00:00', + after: dayjs.utc().toDate(), + before: '2100-01-01', orderBy: 'DATE_ASC', }), new: () => ({ after: '1900-01-01 00:00:00', - before: '2100-01-01 00:00:00', + before: '2100-01-01', orderBy: ['CREATED_AT_DESC', 'DATE_ASC'], }), all: () => ({ - after: '1900-01-01 00:00:00', - before: '2100-01-01 00:00:00', + after: '1900-01-01', + before: '2100-01-01', orderBy: 'DATE_DESC', }), }; diff --git a/migrations/20190325001339_releases.js b/migrations/20190325001339_releases.js index d725d4b9..fec78fc0 100644 --- a/migrations/20190325001339_releases.js +++ b/migrations/20190325001339_releases.js @@ -1004,6 +1004,8 @@ exports.up = knex => Promise.resolve() GROUP BY entities.id; $$ LANGUAGE SQL STABLE; + /* GraphQL/Postgraphile 'every' applies to the data, will only include scenes for which every assigned tag is selected, + instead of what we want; scenes with every selected tag, but possibly also some others */ CREATE FUNCTION actors_scenes(actor actors, selected_tags text[], mode text DEFAULT 'all') RETURNS SETOF releases AS $$ SELECT releases.* FROM releases @@ -1015,18 +1017,22 @@ exports.up = knex => Promise.resolve() tags ON tags.id = releases_tags.tag_id WHERE releases_actors.actor_id = actor.id AND CASE - WHEN mode = 'any' AND array_length(selected_tags, 1) > 0 + /* match at least one of the selected tags */ + WHEN mode = 'any' + AND array_length(selected_tags, 1) > 0 THEN tags.slug = ANY(selected_tags) ELSE true END GROUP BY releases.id HAVING CASE - WHEN mode = 'all' AND array_length(selected_tags, 1) > 0 - THEN COUNT( - CASE WHEN tags.slug = ANY(selected_tags) - THEN true - END - ) = array_length(selected_tags, 1) + /* match all of the selected tags */ + WHEN mode = 'all' + AND array_length(selected_tags, 1) > 0 + THEN COUNT( + CASE WHEN tags.slug = ANY(selected_tags) + THEN true + END + ) = array_length(selected_tags, 1) ELSE true END; $$ LANGUAGE SQL STABLE; diff --git a/seeds/03_studios.js b/seeds/03_studios.js index 19de0282..d7edec27 100644 --- a/seeds/03_studios.js +++ b/seeds/03_studios.js @@ -110,6 +110,12 @@ const studios = [ url: 'https://www.legalporno.com/studios/omar-galanti-productions', parent: 'legalporno', }, + { + slug: 'marywet', + name: 'Marywet', + url: 'https://www.legalporno.com/studios/marywet', + parent: 'legalporno', + }, { slug: 'norestfortheass', name: 'No Rest For The Ass',