cms/app-client/app/serializers/geostat.js
author ymh <ymh.work@gmail.com>
Thu, 03 Nov 2016 11:14:41 +0100
changeset 391 4f6118afabee
parent 355 83f5247f3c7a
permissions -rw-r--r--
Carto improvement: - add count on hover, - carto filter use geonames id resolution - geonames id in filter

import DS from 'ember-data';

export default DS.Serializer.extend({

    normalizeResponse: function(store, primaryModelClass, payload) {
        var data = [];
        Object.keys(payload['geostats']).forEach(function(key) {
            data.push({
                'id': key,
                'type': 'geostat',
                'attributes': {
                    'count': payload['geostats'][key]
                }
            });
        });
        return {
            'data': data
        };
    }

});