|
@@ -15,12 +15,17 @@ App = React.createClass({
|
|
|
getMeteorData() {
|
|
|
let query = {};
|
|
|
|
|
|
+ const uncheckedQuery = { checked: { $ne: true} };
|
|
|
+
|
|
|
if (this.state.hideCompleted) {
|
|
|
// If hideCompleted is checked, filter tasks.
|
|
|
- query = { checked: { $ne: true} };
|
|
|
+ query = uncheckedQuery;
|
|
|
}
|
|
|
let result = {
|
|
|
- tasks: Tasks.find(query, { sort: { createdAt: -1 }}).fetch()
|
|
|
+ tasks: Tasks.find(query, { sort: { createdAt: -1 }}).fetch(),
|
|
|
+ // Since we already have the data in the client-side Minimongo collection,
|
|
|
+ // adding this extra count doesn't involve asking the server for anything.
|
|
|
+ incompleteCount: Tasks.find(uncheckedQuery).count()
|
|
|
};
|
|
|
|
|
|
// Meteor._debug("result", result);
|