From d682f6504b14438c8f20bbc20f24cd766c33e796 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 12 Nov 2020 21:12:58 +0200 Subject: [PATCH] CAKE-168 | fixed getHeightByDate method --- lib/monero/get_height_by_date.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/monero/get_height_by_date.dart b/lib/monero/get_height_by_date.dart index 5393d2a32..ed3d19cac 100644 --- a/lib/monero/get_height_by_date.dart +++ b/lib/monero/get_height_by_date.dart @@ -98,14 +98,14 @@ int getHeigthByDate({DateTime date}) { startHeight = dates.values.toList()[dates.length - 2]; endHeight = dates.values.toList()[dates.length - 1]; final heightPerDay = (endHeight - startHeight) / 31; - final daysHeight = (heightCoefficient * date.day * heightPerDay).round(); + final daysHeight = (heightCoefficient * (date.day - 1) * heightPerDay).round(); height = endHeight + daysHeight; } else { startHeight = dates[raw]; final index = dates.values.toList().indexOf(startHeight); endHeight = dates.values.toList()[index + 1]; final heightPerDay = (endHeight - startHeight) / 31; - final daysHeight = date.day * heightPerDay.round(); + final daysHeight = (date.day - 1) * heightPerDay.round(); height = startHeight + daysHeight; }