Finishing up pathing issues, writing user object if they haven't visited in a day
This commit is contained in:
		
							
								
								
									
										7
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								app.js
									
									
									
									
									
								
							| @@ -352,11 +352,9 @@ app.post('/completed-bonfire/', function (req, res) { | ||||
|                     solution: isSolution | ||||
|                 }) | ||||
|  | ||||
|  | ||||
|                 debug('saving user with a pair'); | ||||
|                 req.user.save(); | ||||
|                 pairedWith.save(); | ||||
|  | ||||
|                 res.redirect('/bonfires'); | ||||
|             } | ||||
|         }) | ||||
|     } else { | ||||
| @@ -372,9 +370,10 @@ app.post('/completed-bonfire/', function (req, res) { | ||||
|         if (index > -1) { | ||||
|             req.user.uncompletedBonfires.splice(index,1) | ||||
|         } | ||||
|         debug("Saving user without a pair"); | ||||
|         req.user.save(); | ||||
|         res.redirect('/bonfires'); | ||||
|     } | ||||
|  | ||||
| }); | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -43,16 +43,15 @@ exports.returnNextBonfire = function(req, res, next) { | ||||
|         var completed = req.user.completedBonfires.map(function(elem) { | ||||
|             return elem._id; | ||||
|         }); | ||||
|         // TODO : remove debug statement | ||||
|         debug(req.user, 'this is the user'); | ||||
|  | ||||
|         req.user.uncompletedBonfires = resources.allBonfireIds().filter(function(elem) { | ||||
|            if (completed.indexOf(elem) === -1) { | ||||
|                return elem; | ||||
|            } | ||||
|         }); | ||||
|         req.user.save(); | ||||
|     } | ||||
|     debug('These are completed bonfires', completed); | ||||
|     debug('These are uncompleted bonfires', req.user.uncompletedBonfires); | ||||
|  | ||||
|  | ||||
|     var uncompletedBonfires = req.user.uncompletedBonfires; | ||||
|  | ||||
|   | ||||
| @@ -39,9 +39,6 @@ $(document).ready(function() { | ||||
|         $('#complete-bonfire-dialog').modal('show'); | ||||
|         // Only post to server if there is an authenticated user | ||||
|         if ($('.signup-btn-nav').length < 1) { | ||||
|             l = location.pathname.split('/'); | ||||
|             cn = l[l.length - 1]; | ||||
|  | ||||
|             $.ajax({ | ||||
|                 type: 'POST', | ||||
|                 data: { | ||||
| @@ -52,7 +49,12 @@ $(document).ready(function() { | ||||
|                     } | ||||
|                 }, | ||||
|                 url: '/completed-bonfire/' | ||||
|             }) | ||||
|  | ||||
|             }); | ||||
|  | ||||
|             //$.post( '/completed-bonfire', function( data ) { | ||||
|             //    window.location = '/bonfires'; | ||||
|             //}); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user