From daaca3c30eb60e38c61fc3dce92e97ee20440e7f Mon Sep 17 00:00:00 2001 From: sando22 Date: Mon, 30 Sep 2013 15:42:07 +0300 Subject: [PATCH] Update Alexander_Iliev_3.rb fixed bug --- class2_homework/Alexander_Iliev_3.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/class2_homework/Alexander_Iliev_3.rb b/class2_homework/Alexander_Iliev_3.rb index 03eb136..d11db69 100644 --- a/class2_homework/Alexander_Iliev_3.rb +++ b/class2_homework/Alexander_Iliev_3.rb @@ -2,9 +2,13 @@ income = 0.00 best_date = String CSV.foreach("bank.csv")do|row| - if income < row[1].to_f - best_date = row[0] - income = row[1].to_f + if best_date == row[0] + income += row[1].to_f + else + if income < row[1].to_f + best_date = row[0] + income = row[1].to_f + end end end printf "%s", best_date