mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-07 06:33:57 -06:00
Each CSV converter can set the certainty of their conversion.
This commit is contained in:
parent
e434de72a3
commit
7707c81b2d
@ -34,6 +34,8 @@ class AccountId extends BasicConverter implements ConverterInterface
|
|||||||
Log::debug('Going to convert using AssetAccountId', ['value' => $value]);
|
Log::debug('Going to convert using AssetAccountId', ['value' => $value]);
|
||||||
|
|
||||||
if ($value === 0) {
|
if ($value === 0) {
|
||||||
|
$this->setCertainty(0);
|
||||||
|
|
||||||
return new Account;
|
return new Account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +49,8 @@ class AccountId extends BasicConverter implements ConverterInterface
|
|||||||
if (!is_null($account->id)) {
|
if (!is_null($account->id)) {
|
||||||
Log::debug('Found account by ID', ['id' => $account->id]);
|
Log::debug('Found account by ID', ['id' => $account->id]);
|
||||||
|
|
||||||
|
$this->setCertainty(100);
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,11 +58,15 @@ class AccountId extends BasicConverter implements ConverterInterface
|
|||||||
// not mapped? Still try to find it first:
|
// not mapped? Still try to find it first:
|
||||||
$account = $repository->find($value);
|
$account = $repository->find($value);
|
||||||
if (!is_null($account->id)) {
|
if (!is_null($account->id)) {
|
||||||
|
$this->setCertainty(90);
|
||||||
|
|
||||||
Log::debug('Found account by ID ', ['id' => $account->id]);
|
Log::debug('Found account by ID ', ['id' => $account->id]);
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setCertainty(0);
|
||||||
|
|
||||||
// should not really happen. If the ID does not match FF, what is FF supposed to do?
|
// should not really happen. If the ID does not match FF, what is FF supposed to do?
|
||||||
return new Account;
|
return new Account;
|
||||||
|
|
||||||
|
@ -40,6 +40,14 @@ class BasicConverter
|
|||||||
return $this->certainty;
|
return $this->certainty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $certainty
|
||||||
|
*/
|
||||||
|
protected function setCertainty(int $certainty)
|
||||||
|
{
|
||||||
|
$this->certainty = $certainty;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $config
|
* @param array $config
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user