Fixed property selection in actors SQL query.
This commit is contained in:
parent
1e4bcb9e02
commit
b034c59d8f
|
@ -311,6 +311,7 @@ async function unstash() {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.photo-link {
|
.photo-link {
|
||||||
|
|
|
@ -323,10 +323,18 @@ async function queryManticoreSql(filters, options, _reqUser) {
|
||||||
if (filters.stashId) {
|
if (filters.stashId) {
|
||||||
builder.select(knex.raw(`
|
builder.select(knex.raw(`
|
||||||
actors.id as id,
|
actors.id as id,
|
||||||
|
actors.gender as gender,
|
||||||
actors.country as country,
|
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.scenes as scenes,
|
||||||
actors.stashed as stashed,
|
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
|
// weight() as _score
|
||||||
|
|
||||||
|
@ -370,7 +378,8 @@ async function queryManticoreSql(filters, options, _reqUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.cup) {
|
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') {
|
if (typeof filters.naturalBoobs === 'boolean') {
|
||||||
|
@ -453,6 +462,8 @@ export async function fetchActors(filters, rawOptions, reqUser) {
|
||||||
|
|
||||||
const result = await queryManticoreSql(filters, options, reqUser);
|
const result = await queryManticoreSql(filters, options, reqUser);
|
||||||
|
|
||||||
|
// console.log('result', result);
|
||||||
|
|
||||||
const actorIds = result.actors.map((actor) => Number(actor.id));
|
const actorIds = result.actors.map((actor) => Number(actor.id));
|
||||||
const [actors, countries] = await Promise.all([
|
const [actors, countries] = await Promise.all([
|
||||||
fetchActorsById(actorIds, {}, reqUser),
|
fetchActorsById(actorIds, {}, reqUser),
|
||||||
|
|
Loading…
Reference in New Issue