<commit_before>class NewsfeedController < ApplicationController

  # verifica se o user esta logado
  before_action :is_logged, except: [:index, :city]

  # verifica se a conta esta completa
  before_action :is_invited

  # verifica se a conta esta completa
  before_action :is_complete, except: [:index, :city]

  include Gmaps



  # Layout newsfeed
  layout 'full-width'


  def index
    if current_or_guest_user.nil?
      redirect_to welcome_path
    elsif current_or_guest_user.city_slug
      redirect_to newsfeed_city_path(current_or_guest_user.city_slug) and return
    else
      redirect_to newsfeed_city_path(City.where(launch: true).first.slug) and return
    end

  end

  def city
    require_relative '../../app/domain/usecases/events/get_event_section'
    require_relative '../../app/domain/usecases/events/get_activity_section'

    @city = City.find_by(slug: params[:city])
    @section_items = Villeme::UseCases::GetEventsSection.get_all_sections(@city, current_or_guest_user)
    @section_items_json = Villeme::UseCases::GetEventsSection.get_all_sections(@city, current_or_guest_user, json: true)
    @section_activities_json = Villeme::UseCases::GetActivitiesSection.get_all_sections(@city, current_or_guest_user, json: true, upcoming: true)
    @number_of_events = @section_items[:all].count
    @message_for_none_events = "Não há eventos no momento em #{@city.name}."
    @feedback = Feedback.new

    # user location
    gon.latitude = current_or_guest_user.latitude<commit_msg>Added upcoming scope to default on get events to section<commit_after>class NewsfeedController < ApplicationController

  # verifica se o user esta logado
  before_action :is_logged, except: [:index, :city]

  # verifica se a conta esta completa
  before_action :is_invited

  # verifica se a conta esta completa
  before_action :is_complete, except: [:index, :city]

  include Gmaps



  # Layout newsfeed
  layout 'full-width'


  def index
    if current_or_guest_user.nil?
      redirect_to welcome_path
    elsif current_or_guest_user.city_slug
      redirect_to newsfeed_city_path(current_or_guest_user.city_slug) and return
    else
      redirect_to newsfeed_city_path(City.where(launch: true).first.slug) and return
    end

  end

  def city
    require_relative '../../app/domain/usecases/events/get_event_section'
    require_relative '../../app/domain/usecases/events/get_activity_section'

    @city = City.find_by(slug: params[:city])
    @section_items = Villeme::UseCases::GetEventsSection.get_all_sections(@city, current_or_guest_user)
    @section_items_json = Villeme::UseCases::GetEventsSection.get_all_sections(@city, current_or_guest_user, json: true, upcoming: true)
    @section_activities_json = Villeme::UseCases::GetActivitiesSection.get_all_sections(@city, current_or_guest_user, json: true)
    @number_of_events = @section_items[:all].count
    @message_for_none_events = "Não há eventos no momento em #{@city.name}."
    @feedback = Feedback.new

    # user location
    gon.latitude = current_or_guest_user.latitude
{'fraction_non_alphanumeric': 0.09040288241074353, 'fraction_numerical': 0.0, 'mean_word_length': 4.676579925650557, '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': '4996318', 'n_tokens_mistral': 1018, 'n_tokens_neox': 1009, 'n_words': 206}