<commit_before>import Ember from 'ember'; // eslint-disable-line
import ResizeAware from 'ember-resize/mixins/resize-aware'; // eslint-disable-line

import carto from '../utils/carto';
import landUseColors from '../utils/landUseColors';

const LandUseChart = Ember.Component.extend(ResizeAware, {
  classNameBindings: ['loading'],
  classNames: ['land-use-chart'],

  resizeWidthSensitive: true,
  resizeHeightSensitive: true,
  loading: false,

  borocd: '',
  sql: Ember.computed('borocd', function sql() {
    const borocd = this.get('borocd');
    const SQL = `
      WITH lots AS (
        SELECT a.the_geom, c.description as landuse_desc, c.code as landuse
        FROM support_mappluto a
        INNER JOIN support_landuse_lookup c
              ON a.landuse::integer = c.code
        INNER JOIN support_admin_cdboundaries b
        ON ST_Contains(b.the_geom, a.the_geom)

        AND b.borocd = '${borocd}'
      ),
      totalsm AS (
        SELECT sum(ST_Area(the_geom::geography)) as total
        FROM lots
      )

      SELECT count(landuse), sum(ST_Area(the_geom::geography)) * 10.7639 as sqft, ROUND((sum(ST_Area(the_geom::geography))/totalsm.total)::numeric,4) as percent, landuse, landuse_desc
      FROM lots, totalsm
      GROUP BY landuse, landuse_desc, totalsm.total
      ORDER BY percent DESC
    `;

    return SQL;
  }),

  data: Ember.computed('sql', 'borocd', function() {
    const sql = this.get('sql');
    return carto.SQL(sql)
      .then((data) => {
        return data;
      });
  }),

  didRender() {
    this.createChart();
  },

  didUpdateAttrs() {
    console.log('updating');
    console.log(this.get('data'));
  },

  createChart: function createChart() {
    const el = this.$();
    const elWidth = el.width();

    const margin = {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0,<commit_msg>Remove test code<commit_after>import Ember from 'ember'; // eslint-disable-line
import ResizeAware from 'ember-resize/mixins/resize-aware'; // eslint-disable-line

import carto from '../utils/carto';
import landUseColors from '../utils/landUseColors';

const LandUseChart = Ember.Component.extend(ResizeAware, {
  classNameBindings: ['loading'],
  classNames: ['land-use-chart'],

  resizeWidthSensitive: true,
  resizeHeightSensitive: true,
  loading: false,

  borocd: '',
  sql: Ember.computed('borocd', function sql() {
    const borocd = this.get('borocd');
    const SQL = `
      WITH lots AS (
        SELECT a.the_geom, c.description as landuse_desc, c.code as landuse
        FROM support_mappluto a
        INNER JOIN support_landuse_lookup c
              ON a.landuse::integer = c.code
        INNER JOIN support_admin_cdboundaries b
        ON ST_Contains(b.the_geom, a.the_geom)

        AND b.borocd = '${borocd}'
      ),
      totalsm AS (
        SELECT sum(ST_Area(the_geom::geography)) as total
        FROM lots
      )

      SELECT count(landuse), sum(ST_Area(the_geom::geography)) * 10.7639 as sqft, ROUND((sum(ST_Area(the_geom::geography))/totalsm.total)::numeric,4) as percent, landuse, landuse_desc
      FROM lots, totalsm
      GROUP BY landuse, landuse_desc, totalsm.total
      ORDER BY percent DESC
    `;

    return SQL;
  }),

  data: Ember.computed('sql', 'borocd', function() {
    const sql = this.get('sql');
    return carto.SQL(sql)
      .then((data) => {
        return data;
      });
  }),

  didRender() {
    this.createChart();
  },
  
  createChart: function createChart() {
    const el = this.$();
    const elWidth = el.width();

    const margin = {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0,
{'fraction_non_alphanumeric': 0.12997787610619468, 'fraction_numerical': 0.006084070796460177, 'mean_word_length': 2.8234672304439745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '499425', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1206, 'n_words': 280}