get photo from crop (saved into ES)

This commit is contained in:
Brenda Wallace
2019-12-21 17:55:34 +13:00
parent ce18dc0610
commit 86a8f95e60
3 changed files with 6 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ module HarvestSearch
planting_id: planting_id,
photos_count: photos.size,
has_photos: photos.size.positive?,
thumbnail_url: default_photo&.thumbnail_url,
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
created_at: created_at.to_i
}
end

View File

@@ -37,7 +37,7 @@ module PlantingSearch
planted_from: planted_from,
quantity: quantity,
sunniness: sunniness,
thumbnail_url: default_photo&.thumbnail_url,
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
created_at: created_at.to_i
}
end

View File

@@ -31,10 +31,11 @@ module SeedSearch
photos_count: photos.size,
plant_before: plant_before,
quantity: quantity,
thumbnail_url: default_photo&.thumbnail_url,
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
tradable_to: tradable_to,
tradeable: tradable?,
finished: finished?,
location: location,
created_at: created_at.to_i
}
end
@@ -43,7 +44,8 @@ module SeedSearch
search('*',
limit: limit,
where: {
photos_count: { gt: 0 }
finished: false,
tradeable: true,
},
boost_by: [:created_at],
load: false)