All the little details

This commit is contained in:
2015-02-20 23:03:38 +01:00
parent 9eb4f8ee9a
commit 006d840c4e
18 changed files with 87 additions and 28 deletions
@@ -2,6 +2,11 @@ module Suppliers
class EmployeeShiftsController < Suppliers::ApplicationController
def index
@employee_shifts = EmployeeShift.for_supplier(current_supplier, relevant_from: 1.week.ago)
@employee_shifts.include_relation(:employee)
# Only select shifts from currently linked and employees
@employee_shifts.select! do |shift|
current_supplier.employee_ids.include?(shift.employee.try(:id))
end
render json: @employee_shifts, each_serializer: Suppliers::EmployeeShiftSerializer
end
def create