mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 16:58:35 -04:00
indexed items matching database attributes
This commit is contained in:
@@ -7,7 +7,7 @@ module Finishable
|
||||
scope :finished, -> { where(finished: true) }
|
||||
scope :current, -> { where.not(finished: true) }
|
||||
|
||||
def active?
|
||||
def active
|
||||
!finished
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,6 +15,10 @@ module PhotoCapable
|
||||
end
|
||||
end
|
||||
|
||||
def thumbnail_url
|
||||
default_photo ? default_photos.thumbnail_url : nil
|
||||
end
|
||||
|
||||
def most_liked_photo
|
||||
photos.order(likes_count: :desc, created_at: :desc).first
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ module SearchCrops
|
||||
# boost this crop for these members
|
||||
planters_ids: plantings.pluck(:owner_id),
|
||||
has_photos: photos.size.positive?,
|
||||
thumbnail_url: default_photo&.thumbnail_url,
|
||||
thumbnail_url: thumbnail_url,
|
||||
scientific_name: default_scientific_name&.name,
|
||||
created_at: created_at.to_i
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ module SearchPlantings
|
||||
def search_data
|
||||
{
|
||||
slug: slug,
|
||||
active: active?,
|
||||
active: active,
|
||||
crop_id: crop_id,
|
||||
crop_name: crop.name,
|
||||
crop_slug: crop.slug,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- if planting.active? && planting.annual? && planting.percentage_grown.present?
|
||||
- if planting.active && planting.annual? && planting.percentage_grown.present?
|
||||
.progress
|
||||
.progress-bar.bg-success{"aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => planting.percentage_grown, role: "progressbar", style: "width: #{planting.percentage_grown}%"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user