<commit_before># encoding: utf-8
require_relative './base_decorator'

module CartoDB
  module Datasources
    module Decorators
      class MailchimpDecorator < BaseDecorator

        # @return bool
        def decorates_layer?
          true
        end

        # @param layer Layer|nil
        # @return bool
        def layer_eligible?(layer=nil)
          return false if layer.nil?
          # Only data/cartodb layers
          return false unless layer.respond_to?(:data_layer?)
          layer.data_layer?
        end

        # @param layer Layer|nil
        def decorate_layer!(layer=nil)
          return nil unless layer_eligible?(layer)

          matches = /^#(.*) \{/.match(layer.options['tile_style'])
          unless matches.nil?
            layer.set_style_options(layer.options['tile_style'] + "\n##{matches[1]}[opened=true] {\nmarker-fill: #006600;\n}")
          end

          nil
        end

      end
    end
  end
end
<commit_msg>Overriding the default style with a better looking one for this particular use case<commit_after># encoding: utf-8
require_relative './base_decorator'

module CartoDB
  module Datasources
    module Decorators
      class MailchimpDecorator < BaseDecorator

        # @return bool
        def decorates_layer?
          true
        end

        # @param layer Layer|nil
        # @return bool
        def layer_eligible?(layer=nil)
          return false if layer.nil?
          # Only data/cartodb layers
          return false unless layer.respond_to?(:data_layer?)
          layer.data_layer?
        end

        # @param layer Layer|nil
        def decorate_layer!(layer=nil)
          return nil unless layer_eligible?(layer)

          matches = /^#(.*) \{/.match(layer.options['tile_style'])
          unless matches.nil?
            layer.options['tile_style'] = "#cartodb_customers{\n" <<
              " marker-fill-opacity: 0.9;\n" <<
              " marker-line-color: #FFF;\n" <<
              " marker-line-width: 1;\n" <<
              " marker-line-opacity: 1;\n" <<
              " marker-placement: point;\n" <<
              " marker-type: ellipse;\n" <<
              " marker-width: 7;\n" <<
              " marker-fill: #FFCC00;\n" <<
              " marker-allow-overlap: true;\n" <<
              " marker-comp-op: multiply;\n" <<
              "}\n" <<
              "\n##{matches[1]}[opened=true]{\n" <<
              " marker-fill: #229A00;\n" <<
              "}"
            layer.set_style_options(layer.options['tile_style'])
          end

          nil
        end

      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11789717819868574, 'fraction_numerical': 0.008504058755315036, 'mean_word_length': 1.7738478027867095, 'pattern_counts': {'":': 0, '<': 33, '<?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': '1220147', 'n_tokens_mistral': 781, 'n_tokens_neox': 744, 'n_words': 164}