(self, form_id, ledger_value)
return ledger_value
Rebuild a LedgerValue and its associated transactions during a form edit workflow.

        :param form_id: ID of edited form
        :param ledger_value: LedgerValue to rebuild with transactions from new form tracked on the model
        :return: updated LedgerValue object
Rebuild a LedgerValue and its associated transactions during a form edit workflow.
Rebuild a LedgerValue and its associated transactions during a form edit workflow .
def _rebuild_ledger(self, form_id, ledger_value):
        """
        Rebuild a LedgerValue and its associated transactions during a form edit workflow.

        :param form_id: ID of edited form
        :param ledger_value: LedgerValue to rebuild with transactions from new form tracked on the model
        :return: updated LedgerValue object
        """
        transactions = LedgerAccessorSQL.get_ledger_transactions_for_case(
            **ledger_value.ledger_reference._asdict()
        )
        transaction_excluding_deprecated_form = [tx for tx in transactions if tx.form_id != form_id]
        new_transactions = ledger_value.get_tracked_models_to_create(LedgerTransaction)
        all_transactions = transaction_excluding_deprecated_form + new_transactions
        sorted_transactions = sorted(all_transactions, key=lambda t: t.report_date)

        ledger_value.clear_tracked_models(LedgerTransaction)
        ledger_value = self._rebuild_ledger_value_from_transactions(
            ledger_value, sorted_transactions, self.domain)
        return ledger_value
def _rebuild_ledger ( self , form_id , ledger_value ) : transactions = LedgerAccessorSQL . get_ledger_transactions_for_case ( * * ledger_value . ledger_reference . _asdict ( ) ) transaction_excluding_deprecated_form = [ tx for tx in transactions if tx . form_id != form_id ] new_transactions = ledger_value . get_tracked_models_to_create ( LedgerTransaction ) all_transactions = transaction_excluding_deprecated_form + new_transactions sorted_transactions = sorted ( all_transactions , key = lambda t : t . report_date ) ledger_value . clear_tracked_models ( LedgerTransaction ) ledger_value = self . _rebuild_ledger_value_from_transactions ( ledger_value , sorted_transactions , self . domain ) return ledger_value