Skip to content

Commit

Permalink
Merge pull request #1 from sqrrm/periodservice-cycles
Browse files Browse the repository at this point in the history
Periodservice cycles
  • Loading branch information
ManfredKarrer committed Apr 9, 2018
2 parents 8022172 + e515138 commit 7cf9935
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
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,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) item.getPhase().getDurationInBlocks();
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 7cf9935

Please sign in to comment.