Check work periods
Javascript, 108 106 bytes
m=>(k=t=0,m.map(l=>(a=l[0]*60+l[1],k+=t?a-b<15?0:a-b:0,b=l[2]*60+l[3],t+=b-a)),t/=60,t<6||k>44||t<9&&k>29)
Takes an array of arrays. Each inner array has the start hour and minute and end hour and minute respectively for each period.
f=m=>( // assign function to f
k=t=0, // k break // t work
m.map(l=>( // for each period
a=l[0]*60+l[1], // started time in minutes
k+=t?a-b<15?0:a-b:0, // if there was a break add it
b=l[2]*60+l[3], // ended time in minutes
t+=b-a // sum worked time (the difference)
)), //
t/=60, // turn t from minutes to hours
t<6||k>44||t<9&&k>29 // the main logic
) //
document.body.innerHTML = '<pre>' +
f([[07,00,12,00],[12,30,15,30],[15,45,17,15]]) + '\n' +
f([[07,20,07,45],[07,59,11,30],[11,55,15,00]]) + '\n' +
f([[06,00,09,00],[09,00,11,50]]) + '\n' +
f([[07,30,12,00],[12,30,16,00]]) + '\n' +
f([[08,00,12,30],[13,05,17,45]]) + '\n' +
f([[08,00,14,00]]) + '\n' +
'</pre>'
Python 3, 135
Saved 3 bytes thanks to DSM.
This is one of my mathier solutions in a while.
def f(l):
h=r=e=0
for(a,b)in l:a+=a%1*2/3;b+=b%1*2/3;h+=b-a;r-=(e-a)*(e and(a-e)>.24);e=b
return(h<6)|(6<=h<9and.5<=r)|(h>9and.74<r)
Here're my test cases, it also shows how I expect the function to be called.
assert f([(07.00, 12.00), (12.30, 15.30), (15.45, 17.15)])
assert not f([(07.20, 07.45), (07.59, 11.30), (11.55, 15.00)])
assert f([(06.00, 09.00), (09.00, 11.50)])
assert f([(07.30, 12.00), (12.30, 16.00)])
assert not f([(08.00, 12.30), (13.05, 17.45)])
assert not f([(08.00, 14.00)])