Guest User

Untitled

a guest
Jul 12th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. ## Time Left
  2.  
  3. - `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)`
  4.  
  5. - `Enum.sum(minute_array) / 60`
  6.  
  7.  
  8. ## Total Time
  9.  
  10. - `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))`
  11.  
  12. - `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