def test_break_up_free_timeblocks_single_timeblock_cases_5():
    free_timeslots_raw = [["08:00", "08:05"]]

    expected_plannable_timeblocks = []

    free_timeslots = [[
        f"{time_s_p[0]}{i[0]}{time_s_p[1]}",
        f"{time_s_p[0]}{i[1]}{time_s_p[1]}"
    ] for i in free_timeslots_raw]

    calculated_free_timeslots = break_up_free_timeblocks(free_timeslots)
    assert calculated_free_timeslots == expected_plannable_timeblocks
Exemplo n.º 2
0
# Done calculating free time during the day.
# If the first free timeblock is very small (less than 15 mins) then ignore it
# We call this: rounding out the free timeblocks

duration_from_now = (datetime.fromisoformat(free_timeblocks[0][0]) -
                     datetime.fromisoformat(time_min)).total_seconds()
if duration_from_now <= 900:
    rounded_free_timeblocks = round_timeblocks(free_timeblocks)
else:
    rounded_free_timeblocks = free_timeblocks

# Done rounding out the free timeslots
# Now we break up the available time into 1 hour chunks.
# We call this plannable_timeblocks

plannable_timeblocks = break_up_free_timeblocks(rounded_free_timeblocks, 3600,
                                                DEBUG_MODE)

print_time_data("Final result: Current time ", time_min, True, True)
print_time_data("Final result: Blocked time ", scheduled_time_blocks, True,
                True)
print_time_data("Final result: Free time ", rounded_free_timeblocks, True,
                True)
print_time_data("Final result: Broken up time blocks ", plannable_timeblocks,
                True, True)

# We now have the plannable chunks of time through the rest of the day
# Time to create events out of them. The user gets to decide whether or not
# an event needs to be planned into a free time block or kept free.

default_event_details = {
    "summary": "make_my_day event",