MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / finalizeReconciliation

Method finalizeReconciliation

reconciliation.go:586–611  ·  view source on GitHub ↗

finalizeReconciliation finalizes the reconciliation process by updating its status and recording the final match/unmatch counts. Parameters: - ctx: The context controlling the request. - reconciliation: The reconciliation object representing the current process. - matchCount: The number of matched t

(ctx context.Context, reconciliation model.Reconciliation, matchCount, unmatchedCount int)

Source from the content-addressed store, hash-verified

584// Returns:
585// - error: If any error occurs during finalization.
586func (s *LedgerForge) finalizeReconciliation(ctx context.Context, reconciliation model.Reconciliation, matchCount, unmatchedCount int) error {
587 // Update the reconciliation status to "completed".
588 reconciliation.Status = StatusCompleted
589 reconciliation.UnmatchedTransactions = unmatchedCount
590 reconciliation.MatchedTransactions = matchCount
591 reconciliation.CompletedAt = ptr.Time(time.Now())
592
593 logrus.Infof("Finalizing reconciliation. Matches: %d, Unmatched: %d", matchCount, unmatchedCount)
594
595 if !reconciliation.IsDryRun {
596 s.postReconciliationActions(ctx, reconciliation)
597 } else {
598 logrus.Infof("Dry run completed. Matches: %d, Unmatched: %d", matchCount, unmatchedCount)
599 }
600
601 // Update the final reconciliation status and counts in the data source.
602 err := s.datasource.UpdateReconciliationStatus(ctx, reconciliation.ReconciliationID, StatusCompleted, matchCount, unmatchedCount)
603 if err != nil {
604 logrus.Errorf("Error updating reconciliation status: %v", err)
605 return err
606 }
607
608 logrus.Infof("Reconciliation %s completed. Total matches: %d, Total unmatched: %d", reconciliation.ReconciliationID, matchCount, unmatchedCount)
609
610 return nil
611}
612
613// oneToOneReconciliation performs a one-to-one reconciliation, where each external transaction is matched against
614// a single internal transaction. The process is parallelized using goroutines.

Callers 1

processReconciliationMethod · 0.95

Calls 2

Tested by

no test coverage detected