Correct sorting

This commit is contained in:
Max Lynch
2013-10-07 00:54:52 -05:00
parent 604f5fe8f7
commit b2b7f51004
2 changed files with 12 additions and 10 deletions

View File

@ -99,7 +99,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
// Set the priorty for this project to the new date, so it will
// sort higher
$scope.activeProject.project.setPriority(+new Date);
$scope.activeProject.project.setPriority(-(+new Date));
$scope.newTask = {};
};
@ -147,7 +147,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
$scope.newProject = {};
var np = $scope.projects.add(p);
np.setPriority(+new Date);
np.setPriority(-(+new Date));
$scope.setActiveProject(np);
};
@ -162,12 +162,14 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
}
}
});
projectsRef.once('child_added', function(snapshot) {
$scope.setActiveProject(
angular.extend({
'$ref': snapshot.ref(),
}, snapshot.val())
)
projectsRef.on('child_added', function(snapshot, prevChildName) {
if(prevChildName === null) {
$scope.setActiveProject(
angular.extend({
'$ref': snapshot.ref(),
}, snapshot.val())
)
}
});
})