Fix employee loading and schedule stuff for supplier

This commit is contained in:
2015-10-07 18:25:31 +02:00
parent 546e1fe10d
commit ec323746fd
6 changed files with 8 additions and 10 deletions
@@ -2,19 +2,19 @@ module Suppliers
class EmployeeShiftsController < Suppliers::ApplicationController
def index
@employee_shifts = EmployeeShift.for_supplier(current_supplier, relevant_from: 1.week.ago)
@employee_shifts.include_relations(:employee, :supplier)
#@employee_shifts.include_relations(:employee, :supplier)
# Only select shifts from currently linked and employees
@employee_shifts.select! do |shift|
return false unless current_supplier.employee_ids.include?(shift.employee.try(:id))
shift.employee.enrich_with_settings current_supplier.settings_for(shift.employee)
true
end
render json: @employee_shifts, include: %w[employee]
render json: @employee_shifts
end
def create
@employee_shift.supplier = current_supplier
@employee_shift.save
render json: @employee_shift, include: %w[employee]
render json: @employee_shift
end
def update