1
0

Added seeding for nutrients/readouts column views

This commit is contained in:
cryptogopher
2019-12-26 22:18:43 +01:00
parent c854fc535b
commit ea8c70e1c0
3 changed files with 16 additions and 1 deletions

View File

@@ -38,6 +38,12 @@ class BodyTrackersController < ApplicationController
flash[:notice] += ", #{new_quantities > 0 ? new_quantities : "no" } new" \
" #{'quantity'.pluralize(new_quantities)}"
ncv = @project.nutrients_column_view
if ncv.quantities.count == 0
ncv.quantities.append(@project.quantities.roots.first(6))
ncv.save!
end
# Sources
available = @project.sources.pluck(:name)
defaults = Source.where(project: nil).map do |s|