From bd66ebd799fdb46167024c8bf1c0dc37aef9d3fb Mon Sep 17 00:00:00 2001
From: "michael.ramusi" <michael.ramusi@etu.hesge.ch>
Date: Sun, 3 Feb 2019 19:54:52 +0100
Subject: [PATCH] fixed omission of get() call to optional

---
 services/src/main/java/ch/hepia/account/AccountDatabase.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/services/src/main/java/ch/hepia/account/AccountDatabase.java b/services/src/main/java/ch/hepia/account/AccountDatabase.java
index 08c9f35..dae8249 100644
--- a/services/src/main/java/ch/hepia/account/AccountDatabase.java
+++ b/services/src/main/java/ch/hepia/account/AccountDatabase.java
@@ -29,7 +29,7 @@ public class AccountDatabase {
     }
 
     public void creditAnAccount(int idAccount, double amount){
-        this.database.get(this.database.indexOf(getById(idAccount))).addAmount(amount);
+        this.database.get(this.database.indexOf(getById(idAccount).get())).addAmount(amount);
     }
 
     public boolean hasEnoughMoney(int idAccount, double price){
@@ -37,6 +37,7 @@ public class AccountDatabase {
     }
 
     public void withdrawCreditAccount(int idAccount, double credit){
-        this.database.get(this.database.indexOf(getById(idAccount))).withdraw(credit);
+        System.out.println("ID:" + idAccount);
+        this.database.get(this.database.indexOf(getById(idAccount).get())).withdraw(credit);
     }
 }
\ No newline at end of file
-- 
GitLab