meetings/free_times.py
def calculate_free_times(busy_blocks, start_time, end_time):
	'''
	Takes a start time, end time, and a list of lists that hold two arrow objects, a start and end time for the events. 
	'''
	merge(busy_blocks)
	completed_free_times = []
	start_time = str(start_time).replace('T', ' ')
	start_time = (arrow.get(start_time), 'YYYY-MM-DD HH:mm:ssZZ')
	end_time = str(end_time).replace('T', ' ')
	end_time = (arrow.get(end_time), 'YYYY-MM-DD HH:mm:ssZZ')
	print("start_time = " + str(start_time))
	print("end_time = " + str(end_time))
	for i in range(len(busy_blocks)-1):
		if busy_blocks[i][0] < start_time:
			del busy_blocks[i]
		# Should be unreachable
		elif busy_blocks[i][1] < start_time:
			del busy_blocks[i]
		elif busy_blocks[i][0] > end_time:
			del busy_blocks[i]
		elif busy_blocks[i][1] > end_time:
			del busy_blocks[i]
		else:
			# Block is in time range
			continue
	if start_time != busy_blocks[0][0]:
		completed_free_times.append([start_time, busy_blocks[0][0]])
	for i in range(len(busy_blocks)-1):
		completed_free_times.append([busy_blocks[i][1], busy_blocks[i+1][0]])
	if end_time != busy_blocks[-1][1]:
		completed_free_times.append([busy_blocks[-1][1], end_time])
	return completed_free_times

	Takes a start time, end time, and a list of lists that hold two arrow objects, a start and end time for the events. 
	
Takes a start time, end time, and a list of lists that hold two arrow objects, a start and end time for the events.
Takes a start time end time and a list of lists that hold two arrow objects a start and end time for the events .
def calculate_free_times(busy_blocks, start_time, end_time):
	merge(busy_blocks)
	completed_free_times = []
	start_time = str(start_time).replace('T', ' ')
	start_time = (arrow.get(start_time), 'YYYY-MM-DD HH:mm:ssZZ')
	end_time = str(end_time).replace('T', ' ')
	end_time = (arrow.get(end_time), 'YYYY-MM-DD HH:mm:ssZZ')
	print("start_time = " + str(start_time))
	print("end_time = " + str(end_time))
	for i in range(len(busy_blocks)-1):
		if busy_blocks[i][0] < start_time:
			del busy_blocks[i]
		elif busy_blocks[i][1] < start_time:
			del busy_blocks[i]
		elif busy_blocks[i][0] > end_time:
			del busy_blocks[i]
		elif busy_blocks[i][1] > end_time:
			del busy_blocks[i]
		else:
			continue
	if start_time != busy_blocks[0][0]:
		completed_free_times.append([start_time, busy_blocks[0][0]])
	for i in range(len(busy_blocks)-1):
		completed_free_times.append([busy_blocks[i][1], busy_blocks[i+1][0]])
	if end_time != busy_blocks[-1][1]:
		completed_free_times.append([busy_blocks[-1][1], end_time])
	return completed_free_times
def calculate_free_times ( busy_blocks , start_time , end_time ) : merge ( busy_blocks ) completed_free_times = [ ] start_time = str ( start_time ) . replace ( 'T' , ' ' ) start_time = ( arrow . get ( start_time ) , 'YYYY-MM-DD HH:mm:ssZZ' ) end_time = str ( end_time ) . replace ( 'T' , ' ' ) end_time = ( arrow . get ( end_time ) , 'YYYY-MM-DD HH:mm:ssZZ' ) print ( "start_time = " + str ( start_time ) ) print ( "end_time = " + str ( end_time ) ) for i in range ( len ( busy_blocks ) - 1 ) : if busy_blocks [ i ] [ 0 ] < start_time : del busy_blocks [ i ] elif busy_blocks [ i ] [ 1 ] < start_time : del busy_blocks [ i ] elif busy_blocks [ i ] [ 0 ] > end_time : del busy_blocks [ i ] elif busy_blocks [ i ] [ 1 ] > end_time : del busy_blocks [ i ] else : continue if start_time != busy_blocks [ 0 ] [ 0 ] : completed_free_times . append ( [ start_time , busy_blocks [ 0 ] [ 0 ] ] ) for i in range ( len ( busy_blocks ) - 1 ) : completed_free_times . append ( [ busy_blocks [ i ] [ 1 ] , busy_blocks [ i + 1 ] [ 0 ] ] ) if end_time != busy_blocks [ - 1 ] [ 1 ] : completed_free_times . append ( [ busy_blocks [ - 1 ] [ 1 ] , end_time ] ) return completed_free_times
Takes a start time, end time, and a list of lists that hold two arrow objects, a start and end time for the events.
Takes a start time end time and a list of lists that hold two arrow objects a start and end time for the events .
'''
	Takes a start time, end time, and a list of lists that hold two arrow objects, a start and end time for the events. 
	''' # Should be unreachable # Block is in time range
busy_blocks
start_time
end_time