Skip to content

Commit

Permalink
added text formatting for workouts
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Jan 11, 2015
1 parent 1c981a0 commit 42f030f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/views/workouts/workouts.jade
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
tbody
tr(ng-repeat='exercise in set.exercises')
td {{exercise.name}}
td(width='150') {{exercise.reps}} {{exercise.type}}
td(width='150') {{exercise.weight}} lbs
td {{set.rest}} Sec
td(width='150') {{formatReps(exercise.reps, exercise.type)}}
td(width='150') {{formatWeight(exercise.weight)}}
td {{formatRest(set.rest)}}
p(ng-show='!workouts.length') Add A Workout

include modals/regime_modal
Expand Down
24 changes: 24 additions & 0 deletions client/views/workouts/workouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@
});
}

// functions to format exercise stats for display
$scope.formatWeight = function(lbs, verbose){
if(lbs === 0){
return verbose ? 'Body Weight' : 'BW'; // 0lbs is a body weight (bw) exercise
}else{
return lbs + ' lbs';
}
};
$scope.formatReps = function(reps, type){
// console.log(reps, type);
if(reps === 0){
return 'Till Fail';
}else{
return reps + ' ' + type[0].toUpperCase() + type.substring(1);
}
};
$scope.formatRest = function(rest){
if(rest === 0){
return 'None';
}else{
return rest + ' Sec';
}
};

setDefaultNewWorkout();
queryRegimes();

Expand Down

0 comments on commit 42f030f

Please sign in to comment.