(domain, user)
Some case properties store the ID of related cases.  This updates those IDs
Some case properties store the ID of related cases.  This updates those IDs
Some case properties store the ID of related cases . This updates those IDs
def _update_case_id_properties(domain, user):
    """Some case properties store the ID of related cases.  This updates those IDs"""

    accessor = CaseAccessors(domain)
    case_ids = accessor.get_case_ids_in_domain()
    cases = list(accessor.get_cases(case_ids))
    case_ids_by_external_id = {c.external_id: c.case_id for c in cases}

    case_blocks = []
    for case in cases:
        update = {}
        for k, v in case.dynamic_case_properties().items():
            if v in case_ids_by_external_id:
                update[k] = case_ids_by_external_id[v]
        if update:
            case_blocks.append(
                CaseBlock.deprecated_init(
                    case_id=case.case_id,
                    user_id=user._id,
                    update=update,
                ).as_xml()
            )

    post_case_blocks(case_blocks, domain=domain, user_id=user._id)
def _update_case_id_properties ( domain , user ) : accessor = CaseAccessors ( domain ) case_ids = accessor . get_case_ids_in_domain ( ) cases = list ( accessor . get_cases ( case_ids ) ) case_ids_by_external_id = { c . external_id : c . case_id for c in cases } case_blocks = [ ] for case in cases : update = { } for k , v in case . dynamic_case_properties ( ) . items ( ) : if v in case_ids_by_external_id : update [ k ] = case_ids_by_external_id [ v ] if update : case_blocks . append ( CaseBlock . deprecated_init ( case_id = case . case_id , user_id = user . _id , update = update , ) . as_xml ( ) ) post_case_blocks ( case_blocks , domain = domain , user_id = user . _id )