CAKE-168 | fixed getHeightByDate method
OleksandrSobol committed
Nov 12, 2020 at 21:12 UTC
d682f6504b14438c8f20bbc20f24cd766c33e796
1 file changed
+2
-2
lib/monero/get_height_by_date.dart
+2
-2
@@ -98,14 +98,14 @@ int getHeigthByDate({DateTime date}) {
98
startHeight = dates.values.toList()[dates.length - 2];
99
endHeight = dates.values.toList()[dates.length - 1];
100
final heightPerDay = (endHeight - startHeight) / 31;
101
- final daysHeight = (heightCoefficient * date.day * heightPerDay).round();
101
+ final daysHeight = (heightCoefficient * (date.day - 1) * heightPerDay).round();
102
height = endHeight + daysHeight;
103
} else {
104
startHeight = dates[raw];
105
final index = dates.values.toList().indexOf(startHeight);
106
endHeight = dates.values.toList()[index + 1];
107
final heightPerDay = (endHeight - startHeight) / 31;
108
- final daysHeight = date.day * heightPerDay.round();
108
+ final daysHeight = (date.day - 1) * heightPerDay.round();
109
height = startHeight + daysHeight;
110
}
111