mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-16 12:40:07 -04:00
Fixed ordering of Harvests - don't order in scope.
This commit is contained in:
@@ -34,6 +34,7 @@ class HarvestsController < ApplicationController
|
||||
|
||||
def create
|
||||
@harvest.crop_id = @harvest.planting.crop_id if @harvest.planting_id
|
||||
@harvest.harvested_at = Time.zone.now if @harvest.harvested_at.blank?
|
||||
@harvest.save
|
||||
respond_with(@harvest)
|
||||
end
|
||||
@@ -72,8 +73,8 @@ class HarvestsController < ApplicationController
|
||||
elsif @planting
|
||||
@planting.harvests
|
||||
else
|
||||
Harvest
|
||||
end.joins(:owner, :crop).paginate(page: params[:page])
|
||||
Harvest.all
|
||||
end.order(harvested_at: :desc).joins(:owner, :crop).paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def csv_filename
|
||||
|
||||
@@ -19,7 +19,8 @@ describe HarvestsController do
|
||||
{
|
||||
owner_id: subject.current_member.id,
|
||||
crop_id: FactoryBot.create(:crop).id,
|
||||
plant_part_id: FactoryBot.create(:plant_part).id
|
||||
plant_part_id: FactoryBot.create(:plant_part).id,
|
||||
harvested_at: '2017-01-01'
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user