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

Method validateDrift

reconciliation.go:1279–1293  ·  view source on GitHub ↗

validateDrift checks the allowable drift for the given field and operator. Drift refers to acceptable deviations (e.g., percentage for amounts or seconds for dates). Parameters: - criteria: The criteria to validate. Returns an error if the drift is invalid.

(criteria model.MatchingCriteria)

Source from the content-addressed store, hash-verified

1277// - criteria: The criteria to validate.
1278// Returns an error if the drift is invalid.
1279func (s *LedgerForge) validateDrift(criteria model.MatchingCriteria) error {
1280 if criteria.Operator == "equals" {
1281 switch criteria.Field {
1282 case "amount":
1283 if criteria.AllowableDrift < 0 || criteria.AllowableDrift > 100 {
1284 return errors.New("drift for amount must be between 0 and 100 (percentage)")
1285 }
1286 case "date":
1287 if criteria.AllowableDrift < 0 {
1288 return errors.New("drift for date must be non-negative (seconds)")
1289 }
1290 }
1291 }
1292 return nil
1293}
1294
1295// getMatchingRules retrieves a list of matching rules by their IDs.
1296// Parameters:

Callers 1

validateCriteriaMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected