[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io
2019-12-25 01:27:49 +00:00
parent 9f46009fd1
commit 950dd7f810
2 changed files with 12 additions and 13 deletions

View File

@@ -16,17 +16,17 @@ class PhotosController < ApplicationController
where = {}
if params[:crop_slug]
@crop = Crop.find params[:crop_slug]
where = { crop_id: @crop.id}
where = { crop_id: @crop.id }
elsif params[:planting_id]
@planting = Planting.find params[:planting_id]
where = { planting_id: @planting.id}
where = { planting_id: @planting.id }
end
@photos = Photo.search(load: false,
boost_by: [:created_at],
where: where,
page: params[:page],
limit: 50)
boost_by: [:created_at],
where: where,
page: params[:page],
limit: 50)
respond_with(@photos)
end

View File

@@ -5,13 +5,12 @@ module SearchPhotos
included do
searchkick merge_mappings: true,
mappings: {
properties: {
title: { type: :text },
created_at: { type: :integer },
}
}
mappings: {
properties: {
title: { type: :text },
created_at: { type: :integer }
}
}
# scope :search_import, -> { includes(:owner, :crops, :plantings, :harvests, :seeds, :posts) }