Meals index, WIP
This commit is contained in:
@@ -6,7 +6,7 @@ class MealsController < ApplicationController
|
||||
include Concerns::Finders
|
||||
|
||||
before_action :find_project_by_project_id, only: [:index, :new, :create]
|
||||
before_action :find_meal, only: [:edit, :update, :destroy]
|
||||
before_action :find_meal, only: [:edit, :update, :destroy, :note, :toggle_eaten]
|
||||
before_action :authorize
|
||||
|
||||
def index
|
||||
@@ -29,9 +29,18 @@ class MealsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
def note
|
||||
end
|
||||
|
||||
def toggle_eaten
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def meal_params
|
||||
|
||||
@@ -33,7 +33,7 @@ class MeasurementsController < ApplicationController
|
||||
@measurement.routine.project = @project
|
||||
@routine = @measurement.routine
|
||||
if @measurement.save
|
||||
if @routine.exposures.empty?
|
||||
if @routine.readout_exposures.empty?
|
||||
@routine.quantities << @measurement.readouts.map(&:quantity).first(6)
|
||||
end
|
||||
|
||||
@@ -83,7 +83,7 @@ class MeasurementsController < ApplicationController
|
||||
end
|
||||
|
||||
def toggle_column
|
||||
@routine.exposures.toggle!(@quantity)
|
||||
@routine.readout_exposures.toggle!(@quantity)
|
||||
prepare_readouts
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user