mmamaev / timeboard

Calendar calculations over business days and work shifts
Other
145 stars 20 forks source link

minutes is not working in timeboard.marker #8

Closed stejeshai closed 5 years ago

stejeshai commented 5 years ago

`tb.Marker(each='D',at=[{'hours':7,'minutes':15, 'seconds':0}, {'hours':15, 'minutes':45, 'seconds':0}], how='from_start_of_each') shifts = tb.Organizer(marker=day_parts, structure=[3,1,2]) clnd = tb.Timeboard(base_unit_freq='H',start='01 Apr 2019 00:15', end='01 Apr 2020 00:15', layout=shifts)

` minutes nor seconds don't even show up in the daily marker, why? is this not a feature? wasted a lot of time over this

mmamaev commented 5 years ago

You used base_unit_freq='H'. This means that the smallest building block in this timeboard equals one hour. Just change base_unit_freq to 'T' (for minutes) or 'S' (for seconds). (Note that a one-year long timeboard based on seconds will take a few seconds to be built.)

day_parts = tb.Marker(each='D',
                      at=[{'hours':7,'minutes':15, 'seconds':0}, 
                          {'hours':15, 'minutes':45, 'seconds':0}], 
                      how='from_start_of_each')
shifts = tb.Organizer(marker=day_parts, structure=[3,1,2])
clnd = tb.Timeboard(base_unit_freq='T',
                    start='01 Apr 2019 00:15', 
                    end='01 Apr 2020 00:15', 
                    layout=shifts)

print(clnd(('01 Apr 2019 00:15', '02 Apr 2019 00:15')))

Interval((0, 2)): 420x'T' at 2019-04-01 00:15 -> 930x'T' at 2019-04-01 15:45 [3]

                 ws_ref               start  duration                 end  \
loc                                                                         
0   2019-04-01 00:15:00 2019-04-01 00:15:00       420 2019-04-01 07:14:59   
1   2019-04-01 07:15:00 2019-04-01 07:15:00       510 2019-04-01 15:44:59   
2   2019-04-01 15:45:00 2019-04-01 15:45:00       930 2019-04-02 07:14:59   

     label  on_duty  
loc                  
0        3     True  
1        1     True  
2        2     True  
stejeshai commented 5 years ago

beautiful, thanks!

stejeshai commented 5 years ago

if you could add this to documentation it would help others (the "T" and "S" markers etc.)