mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-28 19:51:57 -04:00
Use predicted finish times to put current plantings on the timeline
This commit is contained in:
@@ -61,10 +61,15 @@ class GardensController < ApplicationController
|
||||
def timeline
|
||||
@data = []
|
||||
@garden = Garden.find(params[:garden_id])
|
||||
@garden.plantings.where.not(finished_at: nil)
|
||||
.where.not(planted_at: nil)
|
||||
@garden.plantings.where.not(planted_at: nil)
|
||||
.order(finished_at: :desc).each do |p|
|
||||
@data << [p.crop.name, p.planted_at, p.finished_at]
|
||||
|
||||
finish = if p.finished_at.present?
|
||||
p.finished_at
|
||||
else
|
||||
p.finish_predicted_at
|
||||
end
|
||||
@data << [p.crop.name, p.planted_at, finish] if finish.present?
|
||||
end
|
||||
render json: @data
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
.row
|
||||
= timeline garden_timeline_path(@garden), adapter: "google"
|
||||
|
||||
%h3 What's planted here?
|
||||
%h3 Current plantings in garden
|
||||
.row
|
||||
- if @current_plantings.size.positive?
|
||||
- @current_plantings.each do |planting|
|
||||
|
||||
Reference in New Issue
Block a user