meetings/free_times.py
def merge(busy_blocks):
	'''
	Goes through a list of busy blocks of time and make sure than none of them overlap. If they do, 
	we merge them together so that the list is as small as possible.
	'''
	merged_busy_blocks = []
	finished_busy_blocks = []
	sort(busy_blocks)
	for block in busy_blocks:
		for checker in busy_blocks:
			if block[1] < checker[0] or checker[1] < block[0]:
				break
			elif block[0] > checker[0] and block[1] > checker[1]:
				block[0] = checker[0]
				merged_busy_blocks.append([block[0], block[1]])
				break
			elif block[1] > checker[0] and block[0] < checker[1]:
				block[1] = checker[1]
				merged_busy_blocks.append([block[0], block[1]])
				break
			elif block[0] < checker[0] and block[1] > checker[1]:
				merged_busy_blocks.append([block[0], block[1]])
				break
			elif block[0] > checker[0] and block[1] < checker[1]:
				merged_busy_blocks.append([checker[0], checker[1]])
				break
			elif block[0] == checker[0]:
				if block[1] >= checker[1]:
					merged_busy_blocks.append([block[0], block[1]])
				else:
					merged_busy_blocks.append([checker[0], checker[1]])
			elif block[1] == checker[1]:
				if block[0] <= checker[0]:
					merged_busy_blocks.append([block[0], block[1]])
				else:
					merged_busy_blocks.append([checker[0], checker[1]])
			else:
				print("PROBLEM IN CHECKER")
				break
	sort(merged_busy_blocks)
	for i in range(len(merged_busy_blocks)-1):
		if merged_busy_blocks[i][0] == merged_busy_blocks[i+1][0]:
			if merged_busy_blocks[i][1] >= merged_busy_blocks[i+1][1]:
				del merged_busy_blocks[i+1]
			else:
				del merged_busy_blocks[i]
		elif merged_busy_blocks[i][1] == merged_busy_blocks[i+1][1]:
			if merged_busy_blocks[i][0] <= merged_busy_blocks[i+1][0]:
				del merged_busy_blocks[i+1]
			else:
				del merged_busy_blocks[i]

	Goes through a list of busy blocks of time and make sure than none of them overlap. If they do, 
	we merge them together so that the list is as small as possible.
	
Goes through a list of busy blocks of time and make sure than none of them overlap. If they do,
we merge them together so that the list is as small as possible.
Goes through a list of busy blocks of time and make sure than none of them overlap . If they do we merge them together so that the list is as small as possible .
def merge(busy_blocks):
	merged_busy_blocks = []
	finished_busy_blocks = []
	sort(busy_blocks)
	for block in busy_blocks:
		for checker in busy_blocks:
			if block[1] < checker[0] or checker[1] < block[0]:
				break
			elif block[0] > checker[0] and block[1] > checker[1]:
				block[0] = checker[0]
				merged_busy_blocks.append([block[0], block[1]])
				break
			elif block[1] > checker[0] and block[0] < checker[1]:
				block[1] = checker[1]
				merged_busy_blocks.append([block[0], block[1]])
				break
			elif block[0] < checker[0] and block[1] > checker[1]:
				merged_busy_blocks.append([block[0], block[1]])
				break
			elif block[0] > checker[0] and block[1] < checker[1]:
				merged_busy_blocks.append([checker[0], checker[1]])
				break
			elif block[0] == checker[0]:
				if block[1] >= checker[1]:
					merged_busy_blocks.append([block[0], block[1]])
				else:
					merged_busy_blocks.append([checker[0], checker[1]])
			elif block[1] == checker[1]:
				if block[0] <= checker[0]:
					merged_busy_blocks.append([block[0], block[1]])
				else:
					merged_busy_blocks.append([checker[0], checker[1]])
			else:
				print("PROBLEM IN CHECKER")
				break
	sort(merged_busy_blocks)
	for i in range(len(merged_busy_blocks)-1):
		if merged_busy_blocks[i][0] == merged_busy_blocks[i+1][0]:
			if merged_busy_blocks[i][1] >= merged_busy_blocks[i+1][1]:
				del merged_busy_blocks[i+1]
			else:
				del merged_busy_blocks[i]
		elif merged_busy_blocks[i][1] == merged_busy_blocks[i+1][1]:
			if merged_busy_blocks[i][0] <= merged_busy_blocks[i+1][0]:
				del merged_busy_blocks[i+1]
			else:
				del merged_busy_blocks[i]
def merge ( busy_blocks ) : merged_busy_blocks = [ ] finished_busy_blocks = [ ] sort ( busy_blocks ) for block in busy_blocks : for checker in busy_blocks : if block [ 1 ] < checker [ 0 ] or checker [ 1 ] < block [ 0 ] : break elif block [ 0 ] > checker [ 0 ] and block [ 1 ] > checker [ 1 ] : block [ 0 ] = checker [ 0 ] merged_busy_blocks . append ( [ block [ 0 ] , block [ 1 ] ] ) break elif block [ 1 ] > checker [ 0 ] and block [ 0 ] < checker [ 1 ] : block [ 1 ] = checker [ 1 ] merged_busy_blocks . append ( [ block [ 0 ] , block [ 1 ] ] ) break elif block [ 0 ] < checker [ 0 ] and block [ 1 ] > checker [ 1 ] : merged_busy_blocks . append ( [ block [ 0 ] , block [ 1 ] ] ) break elif block [ 0 ] > checker [ 0 ] and block [ 1 ] < checker [ 1 ] : merged_busy_blocks . append ( [ checker [ 0 ] , checker [ 1 ] ] ) break elif block [ 0 ] == checker [ 0 ] : if block [ 1 ] >= checker [ 1 ] : merged_busy_blocks . append ( [ block [ 0 ] , block [ 1 ] ] ) else : merged_busy_blocks . append ( [ checker [ 0 ] , checker [ 1 ] ] ) elif block [ 1 ] == checker [ 1 ] : if block [ 0 ] <= checker [ 0 ] : merged_busy_blocks . append ( [ block [ 0 ] , block [ 1 ] ] ) else : merged_busy_blocks . append ( [ checker [ 0 ] , checker [ 1 ] ] ) else : print ( "PROBLEM IN CHECKER" ) break sort ( merged_busy_blocks ) for i in range ( len ( merged_busy_blocks ) - 1 ) : if merged_busy_blocks [ i ] [ 0 ] == merged_busy_blocks [ i + 1 ] [ 0 ] : if merged_busy_blocks [ i ] [ 1 ] >= merged_busy_blocks [ i + 1 ] [ 1 ] : del merged_busy_blocks [ i + 1 ] else : del merged_busy_blocks [ i ] elif merged_busy_blocks [ i ] [ 1 ] == merged_busy_blocks [ i + 1 ] [ 1 ] : if merged_busy_blocks [ i ] [ 0 ] <= merged_busy_blocks [ i + 1 ] [ 0 ] : del merged_busy_blocks [ i + 1 ] else : del merged_busy_blocks [ i ]
Goes through a list of busy blocks of time and make sure than none of them overlap.
Goes through a list of busy blocks of time and make sure than none of them overlap .
'''
	Goes through a list of busy blocks of time and make sure than none of them overlap. If they do, 
	we merge them together so that the list is as small as possible.
	'''
busy_blocks