mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 22:51:37 +00:00
can read and display workouts
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
var workout = require('../../data/models/workout');
|
||||
|
||||
function loadworkout(req, res, next) {
|
||||
console.log('fetch id' + req.params.title );
|
||||
workout.findOne({title: req.params.title})
|
||||
.populate('elements')
|
||||
|
||||
console.log('fetch id' + req.params._id );
|
||||
workout.findOne({_id: req.params._id})
|
||||
//.populate('elements')
|
||||
.exec(function(err, workout) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -13,6 +12,11 @@ function loadworkout(req, res, next) {
|
||||
return res.send('Not found', 404);
|
||||
}
|
||||
console.log('workout' + JSON.stringify(workout));
|
||||
workout.elements.forEach(function(element, index, array) {
|
||||
// console.log("elementID" + element._id);
|
||||
// console.log("elementID" + JSON.stringify(element.splits));
|
||||
});
|
||||
|
||||
req.workout = workout;
|
||||
next();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user