[refactor][xs]: rename docCount to recordCount.

This commit is contained in:
Rufus Pollock 2012-07-01 09:01:21 +01:00
parent f06b9ad1b1
commit b9555cce6a
5 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@ my.Dataset = Backbone.Model.extend({
creates: []
};
this.facets = new my.FacetList();
this.docCount = null;
this.recordCount = null;
this.queryState = new my.Query();
this.queryState.bind('change', this.query);
this.queryState.bind('facet:add', this.query);
@ -197,7 +197,7 @@ my.Dataset = Backbone.Model.extend({
_handleQueryResult: function(queryResult) {
var self = this;
self.docCount = queryResult.total;
self.recordCount = queryResult.total;
var docs = _.map(queryResult.hits, function(hit) {
var _doc = new my.Record(hit);
_doc.bind('change', function(doc) {
@ -220,7 +220,7 @@ my.Dataset = Backbone.Model.extend({
toTemplateJSON: function() {
var data = this.toJSON();
data.docCount = this.docCount;
data.recordCount = this.recordCount;
data.fields = this.fields.toJSON();
return data;
},

View File

@ -83,7 +83,7 @@ my.MultiView = Backbone.View.extend({
</div> \
</div> \
<div class="recline-results-info"> \
<span class="doc-count">{{docCount}}</span> records\
<span class="doc-count">{{recordCount}}</span> records\
</div> \
<div class="menu-right"> \
<div class="btn-group" data-toggle="buttons-checkbox"> \
@ -166,7 +166,7 @@ my.MultiView = Backbone.View.extend({
});
this.model.bind('query:done', function() {
self.clearNotifications();
self.el.find('.doc-count').text(self.model.docCount || 'Unknown');
self.el.find('.doc-count').text(self.model.recordCount || 'Unknown');
});
this.model.bind('query:fail', function(error) {
self.clearNotifications();

View File

@ -94,14 +94,14 @@ test('DataProxy Backend', function() {
expect(6);
dataset.fetch().then(function() {
deepEqual(['__id__', 'date', 'price'], _.pluck(dataset.fields.toJSON(), 'id'));
equal(10, dataset.docCount)
equal(10, dataset.recordCount)
equal(dataset.currentRecords.models[0].get('date'), "1950-01");
// needed only if not stubbing
// start();
});
dataset.query({q: '1950-01'}).then(function() {
equal(dataset.docCount, 1);
equal(dataset.recordCount, 1);
equal(dataset.currentRecords.models[0].get('price'), '34.73');
});
$.ajax.restore();

View File

@ -280,7 +280,7 @@ test("query", function() {
dataset.fetch().done(function(dataset) {
deepEqual(['_created', '_last_modified', 'end', 'owner', 'start', 'title'], _.pluck(dataset.fields.toJSON(), 'id'));
dataset.query().then(function(recList) {
equal(3, dataset.docCount);
equal(3, dataset.recordCount);
equal(3, recList.length);
equal('Note 1', recList.models[0].get('title'));
start();

View File

@ -178,7 +178,7 @@ test('basics', function () {
dataset.fetch().then(function(datasetAgain) {
equal(dataset.get('name'), memoryData.metadata.name);
deepEqual(_.pluck(dataset.fields.toJSON(), 'id'), _.pluck(data.fields, 'id'));
equal(dataset.docCount, 6);
equal(dataset.recordCount, 6);
});
});