Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Time Left
- - `minute_array = Api.Repo.all(from slot in Api.Slots.Slot, join: job in assoc(slot, :job), left_join: time_entry in assoc(slot, :time_entry), where: is_nil(time_entry.slot_id) and job.id == 10, select: slot.duration_in_minutes)`
- - `Enum.sum(minute_array) / 60`
- ## Total Time
- - `Api.Repo.all(from slot in Api.Slots.Slot, join: job in assoc(slot, :job), left_join: time_entry in assoc(slot, :time_entry), where: time_entry.status == 1 and job.id == 10, preload: (:time_entry))`
- - `Api.Repo.all(from slot in Api.Slots.Slot, join: job in assoc(slot, :job), left_join: time_entry in assoc(slot, :time_entry), where: time_entry.status == 1 and job.id == 10, select: time_entry.break_in_minutes)`
Add Comment
Please, Sign In to add comment