<commit_before>/**
 * Places to watch layer module.
 *
 * @return MiningLayer class (extends CartoDBLayerClass)
 */
define(
  [
    'underscore',
    'abstract/layer/CartoDBLayerClass',
    'text!map/cartocss/Places2Watch.cartocss'
  ],
  function(_, CartoDBLayerClass, Places2WatchCartocss) {
    var Places2WatchLayer = CartoDBLayerClass.extend({
      options: {
        sql:
          "WITH pc as (SELECT * from ptw_config_table where published = TRUE), pg as ( select grid_id, st_symdifference(st_makevalid(ST_Buffer(st_centroid(the_geom_webmercator),5500, 'quad_segs=24')), st_makevalid(ST_Buffer(st_centroid(the_geom_webmercator),5100, 'quad_segs=24'))) as the_geom_webmercator from ptw_grid_score_gt_0 where grid_id in (select grid_id from pc)), ptw AS (SELECT pc.cartodb_id, pc.grid_id, pc.glad_count, pc.name, pc.LINK, pc.image, pc.image_source, pc.overlap_pa, pc.overlap_ifl, pc.description, 'ptw_grid_score_gt_0'::text AS tablename, 'ptw_top_10'::text AS LAYER, TRUE AS actions, TRUE AS analize, TRUE AS readmore, FALSE AS analysis FROM ptw_config_table pc WHERE pc.published = TRUE) SELECT ptw.*, FALSE AS marker, pg.the_geom_webmercator, st_asgeojson(ST_transform(ST_Envelope(pg.the_geom_webmercator),4326)) bbox FROM ptw INNER JOIN pg ON ptw.grid_id = pg.grid_id UNION ALL SELECT ptw.*, TRUE AS marker, St_centroid(pg.the_geom_webmercator) AS the_geom_webmercator,st_asgeojson(ST_transform(ST_Envelope(pg.the_geom_webmercator), 4326)) bbox FROM ptw INNER JOIN pg ON ptw.grid_id = pg.grid_id",
        infowindow: true,
        interactivity:
          'cartodb_id, tablename, name, link, image, image_source, analysis, description, overlap_pa, overlap_ifl, actions, analize, readmore, bbox',
        analysis: false,
        cartocss: Places2WatchCartocss,
        actions: 'analize, readmore'
      },

      changeInfowindow: function(model) {
        if (
          !!model.attributes.content &&
          (!this.infoWindowContent ||
            !_.isEqual(this.infoWindowContent, model.attributes.content))
        ) {
          this.infoWindowContent = model.attributes.content;
          ga(
            'send',
            'event',
            'Map',
            'Open Places to Watch',
            this.infoWindowContent.data.name
          );
        }
<commit_msg>Update sql to point to new table<commit_after>/**
 * Places to watch layer module.
 *
 * @return MiningLayer class (extends CartoDBLayerClass)
 */
define(
  [
    'underscore',
    'abstract/layer/CartoDBLayerClass',
    'text!map/cartocss/Places2Watch.cartocss'
  ],
  function(_, CartoDBLayerClass, Places2WatchCartocss) {
    var Places2WatchLayer = CartoDBLayerClass.extend({
      options: {
        sql:
          "WITH pc as (SELECT * from ptw_config_table where published = TRUE), pg as ( select grid_id, st_symdifference(st_makevalid(ST_Buffer(st_centroid(the_geom_webmercator),5500, 'quad_segs=24')), st_makevalid(ST_Buffer(st_centroid(the_geom_webmercator),5100, 'quad_segs=24'))) as the_geom_webmercator from ptw_grid_may2018_score_gt_0 where grid_id in (select grid_id from pc)), ptw AS (SELECT pc.cartodb_id, pc.grid_id, pc.glad_count, pc.name, pc.LINK, pc.image, pc.image_source, pc.overlap_pa, pc.overlap_ifl, pc.description, 'ptw_grid_may2018_score_gt_0'::text AS tablename, 'ptw_top_10'::text AS LAYER, TRUE AS actions, TRUE AS analize, TRUE AS readmore, FALSE AS analysis FROM ptw_config_table pc WHERE pc.published = TRUE) SELECT ptw.*, FALSE AS marker, pg.the_geom_webmercator, st_asgeojson(ST_transform(ST_Envelope(pg.the_geom_webmercator),4326)) bbox FROM ptw INNER JOIN pg ON ptw.grid_id = pg.grid_id UNION ALL SELECT ptw.*, TRUE AS marker, St_centroid(pg.the_geom_webmercator) AS the_geom_webmercator,st_asgeojson(ST_transform(ST_Envelope(pg.the_geom_webmercator), 4326)) bbox FROM ptw INNER JOIN pg ON ptw.grid_id = pg.grid_id",
        infowindow: true,
        interactivity:
          'cartodb_id, tablename, name, link, image, image_source, analysis, description, overlap_pa, overlap_ifl, actions, analize, readmore, bbox',
        analysis: false,
        cartocss: Places2WatchCartocss,
        actions: 'analize, readmore'
      },

      changeInfowindow: function(model) {
        if (
          !!model.attributes.content &&
          (!this.infoWindowContent ||
            !_.isEqual(this.infoWindowContent, model.attributes.content))
        ) {
          this.infoWindowContent = model.attributes.content;
          ga(
            'send',
            'event',
            'Map',
            'Open Places to Watch',
            this.infoWindowContent.data.name
          );
        }

{'fraction_non_alphanumeric': 0.10275308909603295, 'fraction_numerical': 0.013873834814654238, 'mean_word_length': 3.6465256797583083, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '935199', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1558, 'n_words': 338}