Fixed property selection in actors SQL query.

This commit is contained in:
DebaucheryLibrarian 2024-03-21 03:27:01 +01:00
parent 1e4bcb9e02
commit b034c59d8f
2 changed files with 14 additions and 2 deletions

View File

@ -311,6 +311,7 @@ async function unstash() {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.photo-link {

View File

@ -323,10 +323,18 @@ async function queryManticoreSql(filters, options, _reqUser) {
if (filters.stashId) {
builder.select(knex.raw(`
actors.id as id,
actors.gender as gender,
actors.country as country,
actors.height as height,
actors.weight as weight,
actors.cup as cup,
actors.natural_boobs as natural_boobs,
actors.date_of_birth as date_of_birth,
actors.has_avatar as has_avatar,
actors.scenes as scenes,
actors.stashed as stashed,
created_at as stashed_at
created_at as stashed_at,
if(actors.date_of_birth, floor((now() - actors.date_of_birth) / 31556952), 0) as age
`));
// weight() as _score
@ -370,7 +378,8 @@ async function queryManticoreSql(filters, options, _reqUser) {
}
if (filters.cup) {
builder.where(`regex(cup, '^[${filters.cup[0]}-${filters.cup[1]}]')`, 1);
builder.select(`regex(actors.cup, '^[${filters.cup[0]}-${filters.cup[1]}]') as cup_in_range`);
builder.where('cup_in_range', 1);
}
if (typeof filters.naturalBoobs === 'boolean') {
@ -453,6 +462,8 @@ export async function fetchActors(filters, rawOptions, reqUser) {
const result = await queryManticoreSql(filters, options, reqUser);
// console.log('result', result);
const actorIds = result.actors.map((actor) => Number(actor.id));
const [actors, countries] = await Promise.all([
fetchActorsById(actorIds, {}, reqUser),