Skip to content

Commit

Permalink
Merge pull request #2 from ManfredKarrer/revert-1-periodservice-cycles
Browse files Browse the repository at this point in the history
Revert "Periodservice cycles"
  • Loading branch information
ManfredKarrer authored Apr 9, 2018
2 parents 7cf9935 + 89f3841 commit a5a22b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
language: java
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
notifications:
slack:
on_success: change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,12 @@ protected void deactivate() {

private void onChainHeightChanged(int height) {
phaseBarsItems.forEach(item -> {
int startBlock = periodService.getFirstBlockOfPhase(periodService.getCycle(height), item.getPhase());
int endBlock = periodService.getLastBlockOfPhase(periodService.getCycle(height), item.getPhase());
int startBlock = periodService.getAbsoluteStartBlockOfPhase(height, item.getPhase());
int endBlock = periodService.getAbsoluteEndBlockOfPhase(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) item.getPhase().getDurationInBlocks();
} else if (height < startBlock) {
progress = 0;
} else if (height > endBlock) {
Expand Down

0 comments on commit a5a22b1

Please sign in to comment.