LearningToTalk / L2TDatabase

Helper functions for working with our lab's MySQL database
GNU General Public License v2.0
0 stars 0 forks source link

fix bug in LENA query #59

Closed tjmahr closed 7 years ago

tjmahr commented 7 years ago

HoursAfterMidnight is calculated with

  -- if recording spans two days, give Hours After Midnight as 1 plus last hour
  -- sampled (midnight has an hour of 0)
  if(count(distinct day(a.Hour)) = 2, hour(max(a.Hour)) + 1, 0) as HoursAfterMidnight,

But this fails for recordings are paused overnight, e.g.,

image

I should just write conditional that would ignore rows if Hour < 6 or 22 <= Hour and not worry about counting how many rows after after midnight.