[refactor][xs]: rename docCount to recordCount.
This commit is contained in:
@@ -27,7 +27,7 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
creates: []
|
creates: []
|
||||||
};
|
};
|
||||||
this.facets = new my.FacetList();
|
this.facets = new my.FacetList();
|
||||||
this.docCount = null;
|
this.recordCount = null;
|
||||||
this.queryState = new my.Query();
|
this.queryState = new my.Query();
|
||||||
this.queryState.bind('change', this.query);
|
this.queryState.bind('change', this.query);
|
||||||
this.queryState.bind('facet:add', this.query);
|
this.queryState.bind('facet:add', this.query);
|
||||||
@@ -197,7 +197,7 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
|
|
||||||
_handleQueryResult: function(queryResult) {
|
_handleQueryResult: function(queryResult) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.docCount = queryResult.total;
|
self.recordCount = queryResult.total;
|
||||||
var docs = _.map(queryResult.hits, function(hit) {
|
var docs = _.map(queryResult.hits, function(hit) {
|
||||||
var _doc = new my.Record(hit);
|
var _doc = new my.Record(hit);
|
||||||
_doc.bind('change', function(doc) {
|
_doc.bind('change', function(doc) {
|
||||||
@@ -220,7 +220,7 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
|
|
||||||
toTemplateJSON: function() {
|
toTemplateJSON: function() {
|
||||||
var data = this.toJSON();
|
var data = this.toJSON();
|
||||||
data.docCount = this.docCount;
|
data.recordCount = this.recordCount;
|
||||||
data.fields = this.fields.toJSON();
|
data.fields = this.fields.toJSON();
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ my.MultiView = Backbone.View.extend({
|
|||||||
</div> \
|
</div> \
|
||||||
</div> \
|
</div> \
|
||||||
<div class="recline-results-info"> \
|
<div class="recline-results-info"> \
|
||||||
<span class="doc-count">{{docCount}}</span> records\
|
<span class="doc-count">{{recordCount}}</span> records\
|
||||||
</div> \
|
</div> \
|
||||||
<div class="menu-right"> \
|
<div class="menu-right"> \
|
||||||
<div class="btn-group" data-toggle="buttons-checkbox"> \
|
<div class="btn-group" data-toggle="buttons-checkbox"> \
|
||||||
@@ -166,7 +166,7 @@ my.MultiView = Backbone.View.extend({
|
|||||||
});
|
});
|
||||||
this.model.bind('query:done', function() {
|
this.model.bind('query:done', function() {
|
||||||
self.clearNotifications();
|
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) {
|
this.model.bind('query:fail', function(error) {
|
||||||
self.clearNotifications();
|
self.clearNotifications();
|
||||||
|
|||||||
@@ -94,14 +94,14 @@ test('DataProxy Backend', function() {
|
|||||||
expect(6);
|
expect(6);
|
||||||
dataset.fetch().then(function() {
|
dataset.fetch().then(function() {
|
||||||
deepEqual(['__id__', 'date', 'price'], _.pluck(dataset.fields.toJSON(), 'id'));
|
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");
|
equal(dataset.currentRecords.models[0].get('date'), "1950-01");
|
||||||
// needed only if not stubbing
|
// needed only if not stubbing
|
||||||
// start();
|
// start();
|
||||||
});
|
});
|
||||||
|
|
||||||
dataset.query({q: '1950-01'}).then(function() {
|
dataset.query({q: '1950-01'}).then(function() {
|
||||||
equal(dataset.docCount, 1);
|
equal(dataset.recordCount, 1);
|
||||||
equal(dataset.currentRecords.models[0].get('price'), '34.73');
|
equal(dataset.currentRecords.models[0].get('price'), '34.73');
|
||||||
});
|
});
|
||||||
$.ajax.restore();
|
$.ajax.restore();
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ test("query", function() {
|
|||||||
dataset.fetch().done(function(dataset) {
|
dataset.fetch().done(function(dataset) {
|
||||||
deepEqual(['_created', '_last_modified', 'end', 'owner', 'start', 'title'], _.pluck(dataset.fields.toJSON(), 'id'));
|
deepEqual(['_created', '_last_modified', 'end', 'owner', 'start', 'title'], _.pluck(dataset.fields.toJSON(), 'id'));
|
||||||
dataset.query().then(function(recList) {
|
dataset.query().then(function(recList) {
|
||||||
equal(3, dataset.docCount);
|
equal(3, dataset.recordCount);
|
||||||
equal(3, recList.length);
|
equal(3, recList.length);
|
||||||
equal('Note 1', recList.models[0].get('title'));
|
equal('Note 1', recList.models[0].get('title'));
|
||||||
start();
|
start();
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ test('basics', function () {
|
|||||||
dataset.fetch().then(function(datasetAgain) {
|
dataset.fetch().then(function(datasetAgain) {
|
||||||
equal(dataset.get('name'), memoryData.metadata.name);
|
equal(dataset.get('name'), memoryData.metadata.name);
|
||||||
deepEqual(_.pluck(dataset.fields.toJSON(), 'id'), _.pluck(data.fields, 'id'));
|
deepEqual(_.pluck(dataset.fields.toJSON(), 'id'), _.pluck(data.fields, 'id'));
|
||||||
equal(dataset.docCount, 6);
|
equal(dataset.recordCount, 6);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user