Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @athlete = User.find_by_id(params[:athlete_id]) #this is different in normal controller(non coach)
- @date = Date.parse(params[:date])
- if LogEntry.cal_entry(@date, @athlete.id).size == 0 #check to see if entry exists
- @log_entry = @athlete.log_entries.build
- @log_entry1 = @log_entry.clone
- @workouts = @log_entry.workouts.build
- else #use already existing LogEntry
- @log_entry1 = LogEntry.cal_entry(@date, @athlete.id).first
- @log_entry = @athlete.log_entries.build
- @log_entry = @log_entry1.clone
- @workouts = @log_entry1.workouts.build
- end
- planned_workouts = @workouts.planned_workouts.build
- planned_workouts.planned_workout_times.build(:zone => 1)
- completed_workouts = @workouts.completed_workouts.build
- completed_workouts.workout_times.build(:zone => 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement