Merge branch 'master' of github.com:wbrawner/interval-timer

This commit is contained in:
William Brawner 2015-11-22 19:39:51 -06:00
commit 8a8d4129c9
2 changed files with 16 additions and 23 deletions

View file

@ -36,7 +36,7 @@
</div>
<div class="timer-box">
<div class="timer-info">
<p class="time-info">Round: {{ round + 1 }}/{{ timer.rounds }} - Cycle: {{ cycle + 1 }}/{{ timer.cycles }}</p>
<p class="time-info">Round: {{ round }}/{{ timer.rounds }} - Cycle: {{ cycle }}/{{ timer.cycles }}</p>
<p class="time">{{ time * 1000 | date : "mm:ss" }}</p>
</div>
<div class="timer-controls">

View file

@ -47,8 +47,8 @@
$scope.highIntensityBeep = new Audio('audio/button-42(1).mp3');
$scope.coolDownBeep = new Audio('audio/beep-10.mp3');
$scope.warmUp = true;
$scope.round = 0;
$scope.cycle = 0;
$scope.round = 1;
$scope.cycle = 1;
$scope.time = $scope.timer.warmUpTime;
$scope.settingsOpen = false;
$scope.closeSettings = false;
@ -108,23 +108,16 @@
};
$scope.startHighIntensity = function() {
if ($scope.time == 0) {
if ($scope.round !== $scope.timer.rounds) {
$scope.round++;
}
$scope.highIntensity = false;
if ($scope.round < $scope.timer.rounds) {
$scope.setLowIntensity();
} else {
if ($scope.round == $scope.timer.rounds && $scope.cycle == $scope.timer.cycles) {
$scope.setCoolDown();
} else if ($scope.round == $scope.timer.rounds && $scope.cycle < $scope.timer.cycles) {
$scope.cycle++;
// console.log($scope.cycle);
// console.log($scope.timer.cycles);
if ($scope.cycle < $scope.timer.cycles) {
$scope.warmUp = true;
$scope.setWarmUp();
} else {
$scope.coolDown = true;
$scope.setCoolDown();
}
$scope.round = 1;
$scope.setWarmUp();
} else {
$scope.setLowIntensity();
$scope.round++;
}
};
$scope.$apply(function() {
@ -152,7 +145,7 @@
};
$scope.stepBack = function() {
if ($scope.warmUp) {
if ($scope.cycle != 1) {
if ($scope.cycle != 0) {
$scope.warmUp = false;
$scope.cycle--;
$scope.setHighIntensity();
@ -164,7 +157,7 @@
};
if ($scope.lowIntensity) {
$scope.lowIntensity = false;
if ($scope.round == 1) {
if ($scope.round == 0) {
$scope.setWarmUp();
return;
}
@ -201,7 +194,7 @@
return;
} else if ($scope.round == $scope.timer.rounds && $scope.cycle < $scope.timer.cycles) {
$scope.cycle++;
$scope.round = 0;
$scope.round = 1;
$scope.setWarmUp();
return;
}
@ -213,8 +206,8 @@
$scope.resetTimer = function() {
clearInterval($scope.countdown);
$scope.timerActive = false;
$scope.round = 0;
$scope.cycle = 0;
$scope.round = 1;
$scope.cycle = 1;
$scope.lowIntensity = false;
$scope.highIntensity = false;
$scope.coolDown = false;