def collect_merged_date_field(block_structure, transformer, xblock_field_name, merged_field_name, default_date, func_merge_parents=min, func_merge_ancestors=max):
 for block_key in block_structure.topological_traversal():
  parents = block_structure.get_parents(block_key)
  block_date = get_field_on_block(block_structure.get_xblock(block_key), xblock_field_name)
  if (not parents):
   merged_date_value = (block_date or default_date)
  else:
   merged_all_parents_date = func_merge_parents((block_structure.get_transformer_block_field(parent_key, transformer, merged_field_name, default_date) for parent_key in parents))
   if (not block_date):
    merged_date_value = merged_all_parents_date
   else:
    merged_date_value = func_merge_ancestors(merged_all_parents_date, block_date)
  block_structure.set_transformer_block_field(block_key, transformer, merged_field_name, merged_date_value)

def collect_merged_date_field ( block_structure , transformer , xblock_field_name , merged_field_name , default_date , func_merge_parents = min , func_merge_ancestors = max ) : for block_key in block_structure . topological_traversal ( ) : parents = block_structure . get_parents ( block_key ) block_date = get_field_on_block ( block_structure . get_xblock ( block_key ) , xblock_field_name ) if ( not parents ) : merged_date_value = ( block_date or default_date ) else : merged_all_parents_date = func_merge_parents ( ( block_structure . get_transformer_block_field ( parent_key , transformer , merged_field_name , default_date ) for parent_key in parents ) ) if ( not block_date ) : merged_date_value = merged_all_parents_date else : merged_date_value = func_merge_ancestors ( merged_all_parents_date , block_date ) block_structure . set_transformer_block_field ( block_key , transformer , merged_field_name , merged_date_value )
collects a date xblock field of name xblock_field_name for the given block_structure and transformer .