Forgot to add in previous commit that unnecessary files were also removed. In this commit, time remaining feature was started.

This commit is contained in:
William Brawner 2015-11-22 00:56:13 -06:00
parent 0a35efcfbb
commit cbb4350cec
3 changed files with 22 additions and 3 deletions

View file

@ -84,7 +84,7 @@ a:link, a:hover, a:visited, a:active {
background-color: #1e5f17; background-color: #1e5f17;
} }
.round { .time-info {
font-size: 6vh; font-size: 6vh;
font-style: italic; font-style: italic;
} }

View file

@ -15,7 +15,7 @@
</div> </div>
<div class="timer-box"> <div class="timer-box">
<div class="timer-info"> <div class="timer-info">
<p class="round">{{ round }}/{{ timer.cycles }}</p> <p class="time-info">{{ round }}/{{ timer.cycles }}</p>
<p class="time">{{ time * 1000 | date : "mm:ss" }}</p> <p class="time">{{ time * 1000 | date : "mm:ss" }}</p>
</div> </div>
<div class="timer-controls"> <div class="timer-controls">
@ -24,6 +24,9 @@
<a id="pause" ng-show="timerActive" ng-click="pauseTimer()" class="control-button" href="#"><i class="fa fa-pause"></i></a> <a id="pause" ng-show="timerActive" ng-click="pauseTimer()" class="control-button" href="#"><i class="fa fa-pause"></i></a>
<a id="next" ng-click="stepForward()" class="control-button" href="#"><i class="fa fa-step-forward"></i></a> <a id="next" ng-click="stepForward()" class="control-button" href="#"><i class="fa fa-step-forward"></i></a>
</div> </div>
<div class="timer-info">
<p class="time-info">Time Remaining: {{ timeRemaining | date : "mm:ss" }}</p>
</div>
</div> </div>
<div class="menu-bottom"> <div class="menu-bottom">
<a href="#" ng-click="settingsOpen = true; closeSettings = false;" id="timer-menu-btn" class="menu-button"><i class="fa fa-hourglass-o"></i></a> <a href="#" ng-click="settingsOpen = true; closeSettings = false;" id="timer-menu-btn" class="menu-button"><i class="fa fa-hourglass-o"></i></a>

View file

@ -52,6 +52,15 @@
$scope.time = $scope.timer.warmUpTime; $scope.time = $scope.timer.warmUpTime;
$scope.settingsOpen = false; $scope.settingsOpen = false;
$scope.closeSettings = false; $scope.closeSettings = false;
$scope.getTimeRemaining = function() {
var totalWarmUpTime = $scope.timer.warmUpTime * $scope.timer.repeat;
var totalLowIntensityTime = ($scope.timer.lowIntensityTime * $scope.timer.repeat * $scope.timer.cycles) - ($scope.round * $scope.timer.lowIntensityTime) - ($scope.timer.cycles * $scope.cycle * $scope.timer.lowIntensityTime);
var totalHighIntensityTime = ($scope.timer.highIntensityTime * $scope.timer.repeat * $scope.timer.cycles) - ($scope.round * $scope.timer.highIntensityTime) - ($scope.timer.cycles * $scope.cycle * $scope.timer.highIntensityTime);
var totalCoolDownTime = $scope.timer.coolDownTime;
return (totalWarmUpTime + totalLowIntensityTime + totalHighIntensityTime + totalCoolDownTime) * 1000;
}
$scope.timeRemaining = $scope.getTimeRemaining();
console.log($scope.timeRemaining);
$scope.setWarmUp = function() { $scope.setWarmUp = function() {
clearInterval($scope.countdown); clearInterval($scope.countdown);
$scope.warmUp = true; $scope.warmUp = true;
@ -86,6 +95,7 @@
}; };
$scope.$apply(function() { $scope.$apply(function() {
$scope.time--; $scope.time--;
$scope.timeRemaining = $scope.getTimeRemaining();
}); });
}; };
$scope.startCoolDown = function() { $scope.startCoolDown = function() {
@ -95,6 +105,7 @@
}; };
$scope.$apply(function() { $scope.$apply(function() {
$scope.time--; $scope.time--;
$scope.timeRemaining = $scope.getTimeRemaining();
}); });
}; };
$scope.startLowIntensity = function() { $scope.startLowIntensity = function() {
@ -104,6 +115,7 @@
}; };
$scope.$apply(function() { $scope.$apply(function() {
$scope.time--; $scope.time--;
$scope.timeRemaining = $scope.getTimeRemaining();
}); });
}; };
$scope.startHighIntensity = function() { $scope.startHighIntensity = function() {
@ -128,6 +140,7 @@
}; };
$scope.$apply(function() { $scope.$apply(function() {
$scope.time--; $scope.time--;
$scope.timeRemaining = $scope.getTimeRemaining();
}); });
}; };
$scope.startTimer = function() { $scope.startTimer = function() {
@ -156,7 +169,10 @@
$scope.cycle--; $scope.cycle--;
$scope.setHighIntensity(); $scope.setHighIntensity();
return; return;
}; } else {
$scope.resetTimer();
return;
}
}; };
if ($scope.lowIntensity) { if ($scope.lowIntensity) {
$scope.lowIntensity = false; $scope.lowIntensity = false;