mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-30 14:36:06 +00:00
CAKE-168 | fixed getHeightByDate method
This commit is contained in:
parent
70467b1fe7
commit
d682f6504b
1 changed files with 2 additions and 2 deletions
|
@ -98,14 +98,14 @@ int getHeigthByDate({DateTime date}) {
|
||||||
startHeight = dates.values.toList()[dates.length - 2];
|
startHeight = dates.values.toList()[dates.length - 2];
|
||||||
endHeight = dates.values.toList()[dates.length - 1];
|
endHeight = dates.values.toList()[dates.length - 1];
|
||||||
final heightPerDay = (endHeight - startHeight) / 31;
|
final heightPerDay = (endHeight - startHeight) / 31;
|
||||||
final daysHeight = (heightCoefficient * date.day * heightPerDay).round();
|
final daysHeight = (heightCoefficient * (date.day - 1) * heightPerDay).round();
|
||||||
height = endHeight + daysHeight;
|
height = endHeight + daysHeight;
|
||||||
} else {
|
} else {
|
||||||
startHeight = dates[raw];
|
startHeight = dates[raw];
|
||||||
final index = dates.values.toList().indexOf(startHeight);
|
final index = dates.values.toList().indexOf(startHeight);
|
||||||
endHeight = dates.values.toList()[index + 1];
|
endHeight = dates.values.toList()[index + 1];
|
||||||
final heightPerDay = (endHeight - startHeight) / 31;
|
final heightPerDay = (endHeight - startHeight) / 31;
|
||||||
final daysHeight = date.day * heightPerDay.round();
|
final daysHeight = (date.day - 1) * heightPerDay.round();
|
||||||
height = startHeight + daysHeight;
|
height = startHeight + daysHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue