<commit_before># encoding: utf-8

require 'carto/api/vizjson3_presenter'
require 'carto/api/layer_presenter'

require_dependency 'carto/tracking/events'
require_dependency 'carto/visualization_migrator'

module Carto
  module Builder
    class VisualizationsController < BuilderController
      include VisualizationsControllerHelper
      include Carto::VisualizationMigrator

      ssl_required :show

      before_filter :load_derived_visualization,
                    :redirect_to_editor_if_forced,
                    :auto_migrate_visualization_if_possible, only: :show
      before_filter :authors_only
      before_filter :editable_visualizations_only, :load_carto_viewer, only: :show

      # TODO: remove this when analysis logic lives in the backend
      before_filter :ensure_source_analyses, unless: :has_analyses?

      after_filter :update_user_last_activity,
                   :track_builder_visit, only: :show

      layout 'application_builder'

      def show
        @visualization_data = Carto::Api::VisualizationPresenter.new(@visualization, current_viewer, self).to_poro
        @layers_data = @visualization.layers.map do |l|
          Carto::Api::LayerPresenter.new(l, with_style_properties: true).to_poro(migrate_builder_infowindows: true)
        end
        @vizjson = generate_anonymous_map_vizjson3(@visualization, params)
        @state = @visualization.state.json
        @analyses_data = @visualization.analyses.map { |a| Carto::Api::AnalysisPresenter.new(a).to_poro }
        @basemaps = Cartodb.config[:basemaps].present? && Cartodb.config[:basemaps]<commit_msg>Providing proper basemaps to users, no Gmaps when user doesn't have GMaps enabled<commit_after># encoding: utf-8

require 'carto/api/vizjson3_presenter'
require 'carto/api/layer_presenter'

require_dependency 'carto/tracking/events'
require_dependency 'carto/visualization_migrator'

module Carto
  module Builder
    class VisualizationsController < BuilderController
      include VisualizationsControllerHelper
      include Carto::VisualizationMigrator

      ssl_required :show

      before_filter :load_derived_visualization,
                    :redirect_to_editor_if_forced,
                    :auto_migrate_visualization_if_possible, only: :show
      before_filter :authors_only
      before_filter :editable_visualizations_only, :load_carto_viewer, only: :show

      # TODO: remove this when analysis logic lives in the backend
      before_filter :ensure_source_analyses, unless: :has_analyses?

      after_filter :update_user_last_activity,
                   :track_builder_visit, only: :show

      layout 'application_builder'

      def show
        @visualization_data = Carto::Api::VisualizationPresenter.new(@visualization, current_viewer, self).to_poro
        @layers_data = @visualization.layers.map do |l|
          Carto::Api::LayerPresenter.new(l, with_style_properties: true).to_poro(migrate_builder_infowindows: true)
        end
        @vizjson = generate_anonymous_map_vizjson3(@visualization, params)
        @state = @visualization.state.json
        @analyses_data = @visualization.analyses.map { |a| Carto::Api::AnalysisPresenter.new(a).to_poro }
        @basemaps = current_viewer.basemaps
{'fraction_non_alphanumeric': 0.07770897832817338, 'fraction_numerical': 0.0018575851393188853, 'mean_word_length': 3.9178082191780823, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7056851', 'n_tokens_mistral': 999, 'n_tokens_neox': 933, 'n_words': 180}