Skip to content

Commit

Permalink
added distance updater
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Aug 23, 2014
1 parent e085345 commit f3e7afa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/trips.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ exports.show = function(req, res){
};

exports.updateDist = function(req, res){

Trip.updateDist(req.params.tripId, req.body, function(){
res.send({success:true});
});
};
6 changes: 6 additions & 0 deletions app/models/trip.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ Trip.prototype.moveFile = function(files){
this.photo = photos[0];
};

Trip.updateDist = function(id, body, cb){
id = Mongo.ObjectID(id);
// console.log(body.distance);
Trip.collection.update({_id:id}, {$set:{distance:parseFloat(body.distance)}}, cb);
};

Trip.prototype.save = function(cb){
Trip.collection.save(this, cb);
};
Expand Down
Binary file added app/static/img/53f8c045d7c08fa5097ca44a/0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f3e7afa

Please sign in to comment.