Fixed pagination and scene poster overflowing page on small screens. Fixed back reload interfering with tag page hashes.

This commit is contained in:
2024-03-19 20:50:50 +01:00
parent 21eaa98de4
commit 52708b5d70
12 changed files with 141 additions and 77 deletions

View File

@@ -125,8 +125,6 @@ export async function fetchScenesById(sceneIds, reqUser) {
: [],
]);
console.log(reqUser, stashes);
return sceneIds.map((sceneId) => {
const scene = scenes.find((sceneEntry) => sceneEntry.id === sceneId);
@@ -420,8 +418,8 @@ async function queryManticoreSql(filters, options, _reqUser) {
if (filters.entityId) {
builder.where((whereBuilder) => {
whereBuilder
.where('channel_id', filters.entityId)
.orWhere('network_id', filters.entityId);
.where('scenes.channel_id', filters.entityId)
.orWhere('scenes.network_id', filters.entityId);
});
}
@@ -483,7 +481,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
const results = await utilsApi.sql(curatedSqlQuery);
// console.log(results);
console.log(results[0]);
const actorIds = results
.find((result) => (result.columns[0].actor_ids || result.columns[0]['scenes.actor_ids']) && result.columns[1]['count(*)'])

View File

@@ -1,28 +1,28 @@
import { indexApi, utilsApi } from '../manticore.js';
import rawMovies from './movies.json' with { type: 'json' };
import rawvideos from './movies.json' with { type: 'json' };
async function fetchMovies() {
const movies = rawMovies
.filter((movie) => movie.cast.length > 0
&& movie.genres.length > 0
&& movie.cast.every((actor) => actor.charCodeAt(0) >= 65)) // throw out movies with non-alphanumerical actor names
.map((movie, index) => ({ id: index + 1, ...movie }));
async function fetchvideos() {
const videos = rawvideos
.filter((video) => video.cast.length > 0
&& video.genres.length > 0
&& video.cast.every((actor) => actor.charCodeAt(0) >= 65)) // throw out videos with non-alphanumerical actor names
.map((video, index) => ({ id: index + 1, ...video }));
const actors = Array.from(new Set(movies.flatMap((movie) => movie.cast))).sort();
const genres = Array.from(new Set(movies.flatMap((movie) => movie.genres)));
const actors = Array.from(new Set(videos.flatMap((video) => video.cast))).sort();
const genres = Array.from(new Set(videos.flatMap((video) => video.genres)));
return {
movies,
videos,
actors,
genres,
};
}
async function init() {
await utilsApi.sql('drop table if exists movies');
await utilsApi.sql('drop table if exists movies_liked');
await utilsApi.sql('drop table if exists videos');
await utilsApi.sql('drop table if exists videos_liked');
await utilsApi.sql(`create table movies (
await utilsApi.sql(`create table videos (
id int,
title text,
actor_ids multi,
@@ -31,37 +31,37 @@ async function init() {
genres text
)`);
await utilsApi.sql(`create table movies_liked (
await utilsApi.sql(`create table videos_liked (
id int,
user_id int,
movie_id int
video_id int
)`);
const { movies, actors, genres } = await fetchMovies();
const { videos, actors, genres } = await fetchvideos();
const likedMovieIds = Array.from(new Set(Array.from({ length: 10.000 }, () => movies[Math.round(Math.random() * movies.length)].id)));
const likedvideoIds = Array.from(new Set(Array.from({ length: 10.000 }, () => videos[Math.round(Math.random() * videos.length)].id)));
const docs = movies
.map((movie) => ({
const docs = videos
.map((video) => ({
replace: {
index: 'movies',
id: movie.id,
index: 'videos',
id: video.id,
doc: {
title: movie.title,
actor_ids: movie.cast.map((actor) => actors.indexOf(actor)),
actors: movie.cast.join(','),
genre_ids: movie.genres.map((genre) => genres.indexOf(genre)),
genres: movie.genres.join(','),
title: video.title,
actor_ids: video.cast.map((actor) => actors.indexOf(actor)),
actors: video.cast.join(','),
genre_ids: video.genres.map((genre) => genres.indexOf(genre)),
genres: video.genres.join(','),
},
},
}))
.concat(likedMovieIds.map((movieId, index) => ({
.concat(likedvideoIds.map((videoId, index) => ({
replace: {
index: 'movies_liked',
index: 'videos_liked',
id: index + 1,
doc: {
user_id: Math.floor(Math.random() * 51),
movie_id: movieId,
video_id: videoId,
},
},
})));
@@ -71,7 +71,7 @@ async function init() {
console.log('data', data);
const result = await utilsApi.sql(`
select * from movies_liked
select * from videos_liked
limit 10
`);