Add rubocop spacing rules
We were following these rules in most places; we just didn't define them anywhere.
This commit is contained in:
@@ -116,7 +116,7 @@ class CensusApi
|
||||
end
|
||||
|
||||
def stubbed_invalid_response
|
||||
{get_habita_datos_response: {get_habita_datos_return: {datos_habitante: {}, datos_vivienda: {}}}}
|
||||
{ get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}, datos_vivienda: {}}}}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ module GraphQL
|
||||
type created_type
|
||||
description model.graphql_field_description
|
||||
argument :id, !types.ID
|
||||
resolve ->(object, arguments, context) { model.public_for_api.find_by(id: arguments["id"])}
|
||||
resolve ->(object, arguments, context) { model.public_for_api.find_by(id: arguments["id"]) }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class ManagerAuthenticator
|
||||
|
||||
def initialize(data = {})
|
||||
@manager = {login: data[:login], user_key: data[:clave_usuario], date: data[:fecha_conexion]}.with_indifferent_access
|
||||
@manager = { login: data[:login], user_key: data[:clave_usuario], date: data[:fecha_conexion] }.with_indifferent_access
|
||||
end
|
||||
|
||||
def auth
|
||||
return false unless [@manager[:login], @manager[:user_key], @manager[:date]].all? {|manager| manager.present?}
|
||||
return false unless [@manager[:login], @manager[:user_key], @manager[:date]].all? { |manager| manager.present? }
|
||||
return @manager if manager_exists? && application_authorized?
|
||||
false
|
||||
end
|
||||
@@ -13,7 +13,7 @@ class ManagerAuthenticator
|
||||
private
|
||||
|
||||
def manager_exists?
|
||||
response = client.call(:get_status_user_data, message: { ub: {user_key: @manager[:user_key], date: @manager[:date]} }).body
|
||||
response = client.call(:get_status_user_data, message: { ub: { user_key: @manager[:user_key], date: @manager[:date] }}).body
|
||||
parsed_response = parser.parse((response[:get_status_user_data_response][:get_status_user_data_return]))
|
||||
@manager[:login] == parsed_response["USUARIO"]["LOGIN"]
|
||||
rescue
|
||||
@@ -21,7 +21,7 @@ class ManagerAuthenticator
|
||||
end
|
||||
|
||||
def application_authorized?
|
||||
response = client.call(:get_applications_user_list, message: { ub: {user_key: @manager[:user_key]} }).body
|
||||
response = client.call(:get_applications_user_list, message: { ub: { user_key: @manager[:user_key] }}).body
|
||||
parsed_response = parser.parse((response[:get_applications_user_list_response][:get_applications_user_list_return]))
|
||||
aplication_value = parsed_response["APLICACIONES"]["APLICACION"]
|
||||
# aplication_value from UWEB can be an array of hashes or a hash
|
||||
|
||||
@@ -64,7 +64,7 @@ class RemoteCensusApi
|
||||
end
|
||||
|
||||
def parse_path(path_value)
|
||||
path_value.split(".").map{ |section| section.to_sym } if path_value.present?
|
||||
path_value.split(".").map { |section| section.to_sym } if path_value.present?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,7 +105,7 @@ class RemoteCensusApi
|
||||
end
|
||||
|
||||
def parse_path(path_value)
|
||||
path_value.split(".").map{ |section| section.to_sym } if path_value.present?
|
||||
path_value.split(".").map { |section| section.to_sym } if path_value.present?
|
||||
end
|
||||
|
||||
def update_value(structure, path, value)
|
||||
@@ -153,7 +153,7 @@ class RemoteCensusApi
|
||||
end
|
||||
|
||||
def stubbed_invalid_response
|
||||
{get_habita_datos_response: {get_habita_datos_return: {datos_habitante: {}, datos_vivienda: {}}}}
|
||||
{ get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}, datos_vivienda: {}}}}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class RemoteTranslations::Microsoft::Client
|
||||
|
||||
split_position = detect_split_position(text)
|
||||
start_text = text[0..split_position]
|
||||
end_text = text[split_position + 1 .. text.size]
|
||||
end_text = text[split_position + 1..text.size]
|
||||
|
||||
fragments_for(start_text) + [end_text]
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ module ScoreCalculator
|
||||
period = [1, [max_period, resource_age(resource)].min].max
|
||||
|
||||
votes_total = resource.votes_for.where("created_at >= ?", period.days.ago).count
|
||||
votes_up = resource.get_upvotes.where("created_at >= ?", period.days.ago).count
|
||||
votes_up = resource.get_upvotes.where("created_at >= ?", period.days.ago).count
|
||||
votes_down = votes_total - votes_up
|
||||
votes_score = votes_up - votes_down
|
||||
|
||||
|
||||
Reference in New Issue
Block a user