feat: Implement group balance and expense management with new navigation and data handling
This commit is contained in:
@@ -30,6 +30,20 @@ class BalanceService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Settlement>> calculateOptimalSettlements(String groupId) async {
|
||||
try {
|
||||
final expenses = await _expenseRepository
|
||||
.getExpensesStream(groupId)
|
||||
.first;
|
||||
|
||||
final userBalances = calculateUserBalances(expenses);
|
||||
return optimizeSettlements(userBalances);
|
||||
} catch (e) {
|
||||
_errorService.logError('BalanceService', 'Erreur calcul settlements: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Stream de la balance en temps réel
|
||||
Stream<GroupBalance> getGroupBalanceStream(String groupId) {
|
||||
return _expenseRepository.getExpensesStream(groupId).asyncMap((expenses) async {
|
||||
|
||||
Reference in New Issue
Block a user