"use strict";
/**
 * Get count of database-wide values.
 **/
define([
    "underscore",
    "underscore.string",
    "backbone",
    "app"
], function(_, _s, Backbone, app) {

    var GlobalCountModel = Backbone.Model.extend({
        url: function() {
            return "_view/global?group=true";
        },

        /**
         * Parse the *grouped* values.
         **/
        parse: function(response, options){
            var results = {};

            if (_.has(response, "rows") && _.isArray(response.rows)) {
                _.each(response.rows, function(row) {
                    results[row.key] = row.value;
                });
            }

            return results;
        },

        toJSON: function() {
            var result = this.attributes;
            // Customize the strings.
            _.each(_.pairs(this.attributes), function(pair) {
                result[pair[0] + "_fmt"] = _s.numberFormat(pair[1], 0);
            });
            return result;
        }

    });

    return GlobalCountModel;
});

@@ -124,19 +124,8 @@
 one%22
-,%0A    %22app%22
 %0A%5D, 
@@ -152,13 +152,8 @@
 bone
-, app
 ) %7B%0A

Remove circular reference