Skip to content

Commit

Permalink
Rename StartBlock to FirstBlock, EndBlock to LastBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
sqrrm committed Apr 7, 2018
1 parent 405a074 commit c5b01a0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ protected void deactivate() {

private void onChainHeightChanged(int height) {
phaseBarsItems.forEach(item -> {
int startBlock = periodService.getAbsoluteStartBlockOfPhase(height, item.getPhase());
int endBlock = periodService.getAbsoluteEndBlockOfPhase(height, item.getPhase());
int startBlock = periodService.getFirstBlockOfPhase(periodService.getCycle(height), item.getPhase());
int endBlock = periodService.getLastBlockOfPhase(periodService.getCycle(height), item.getPhase());
item.setStartAndEnd(startBlock, endBlock);
double progress = 0;
if (height >= startBlock && height <= endBlock) {
progress = (double) (height - startBlock + 1) / (double) periodService.getCycle(height).getPhaseDuration(item.getPhase());
progress = (double) (height - startBlock + 1) /
(double) periodService.getCycle(height).getPhaseDuration(item.getPhase());
} else if (height < startBlock) {
progress = 0;
} else if (height > endBlock) {
Expand Down

0 comments on commit c5b01a0

Please sign in to comment.