daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)`
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top