Skip to content

Commit e96d78e

Browse files
committed
fix txFilterSameFields
really fix #401
1 parent 1f13430 commit e96d78e

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

lib/pages/transaction.dart

+29-8
Original file line numberDiff line numberDiff line change
@@ -2302,17 +2302,38 @@ TransactionSplitUpdate txFilterSameFields(
23022302
'destination_id', 'destination_name', 'destination_number', 'destination_iban',
23032303
];
23042304
*/
2305-
return txU.copyWith(
2306-
amount: tx.amount == txU.amount ? null : txU.amount,
2307-
foreignAmount:
2308-
tx.foreignAmount == txU.foreignAmount ? null : txU.foreignAmount,
2305+
final String? amount =
2306+
(txU.amount == null ||
2307+
double.parse(tx.amount) == double.parse(txU.amount!))
2308+
? null
2309+
: txU.amount;
2310+
String? foreignAmount;
2311+
if (txU.foreignAmount != null) {
2312+
if (tx.foreignAmount == null) {
2313+
foreignAmount = txU.foreignAmount;
2314+
} else if (double.parse(tx.foreignAmount!) ==
2315+
double.parse(txU.foreignAmount!)) {
2316+
foreignAmount = null;
2317+
} else {
2318+
foreignAmount = txU.foreignAmount;
2319+
}
2320+
}
2321+
2322+
return txU.copyWithWrapped(
2323+
amount: Wrapped<String?>.value(amount),
2324+
foreignAmount: Wrapped<String?>.value(foreignAmount),
23092325
foreignCurrencyId:
23102326
tx.foreignCurrencyId == txU.foreignCurrencyId
2311-
? null
2312-
: txU.foreignCurrencyId,
2313-
sourceName: tx.sourceName == txU.sourceName ? null : txU.sourceName,
2327+
? Wrapped<String?>.value(null)
2328+
: Wrapped<String?>.value(txU.foreignCurrencyId),
2329+
sourceName:
2330+
tx.sourceName == txU.sourceName
2331+
? Wrapped<String?>.value(null)
2332+
: Wrapped<String?>.value(txU.sourceName),
23142333
destinationName:
2315-
tx.destinationName == txU.destinationName ? null : txU.destinationName,
2334+
tx.destinationName == txU.destinationName
2335+
? Wrapped<String?>.value(null)
2336+
: Wrapped<String?>.value(txU.destinationName),
23162337
);
23172338
}
23182339

0 commit comments

Comments
 (0)