mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 21:15:19 +02:00
Account-level import configuration templates (#1946)
* Account-level import configuration templates * Default import to family's preferred date format
This commit is contained in:
parent
5b2fa3d707
commit
0544089710
15 changed files with 108 additions and 43 deletions
|
@ -2,8 +2,11 @@ class Import::AccountMapping < Import::Mapping
|
|||
validates :mappable, presence: true, if: :requires_mapping?
|
||||
|
||||
class << self
|
||||
def mapping_values(import)
|
||||
import.rows.map(&:account).uniq
|
||||
def mappables_by_key(import)
|
||||
unique_values = import.rows.map(&:account).uniq
|
||||
accounts = import.family.accounts.where(name: unique_values).index_by(&:name)
|
||||
|
||||
unique_values.index_with { |value| accounts[value] }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue