Skip to content

Commit

Permalink
formato rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
vtamara committed Mar 15, 2023
1 parent ade3886 commit 7f8ea74
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ Metrics/ParameterLists:

AllCops:
NewCops: enable
SuggestExtensions: false


54 changes: 29 additions & 25 deletions app/models/usuario.rb
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
# frozen_string_literal: true

require "sivel2_gen/concerns/models/usuario"
require "cor1440_gen/concerns/models/usuario"

class Usuario < ActiveRecord::Base
include Sivel2Gen::Concerns::Models::Usuario
include Cor1440Gen::Concerns::Models::Usuario

belongs_to :tdocumento,
belongs_to :tdocumento,
class_name: "Msip::Tdocumento",
validate: true,
validate: true,
optional: false

campofecha_localizado :fechanac

validates :numerodocumento,
length: { maximum: 100 },
presence: true,
allow_blank: false
validates :numerodocumento,
length: { maximum: 100 },
presence: true,
allow_blank: false
validates :tdocumento, presence: true, allow_blank: false
validates :numerodocumento,
presence: true,
allow_blank: false,
uniqueness: {
scope: :tdocumento,
message: "Tipo y número de documento repetido",}
validates :numerodocumento,
presence: true,
allow_blank: false,
uniqueness: {
scope: :tdocumento,
message: "Tipo y número de documento repetido",
}
validates :fechanac, presence: true, allow_blank: false
validates :sexonac, presence: true
if defined?(Msip::Persona.convencion_sexo[:sexo_femenino])
validates :sexonac, inclusion: {
in: [
Msip::Persona.convencion_sexo[:sexo_femenino].to_s,
Msip::Persona.convencion_sexo[:sexo_masculino].to_s,
Msip::Persona.convencion_sexo[:sexo_sininformacion].to_s,
],
message: "Sexó debe ser " +
Msip::Persona.convencion_sexo[:sexo_femenino].to_s + " o " +
Msip::Persona.convencion_sexo[:sexo_masculino].to_s + " o " +
Msip::Persona.convencion_sexo[:sexo_sininformacion].to_s,}
validates :sexonac, inclusion: {
in: [
Msip::Persona.convencion_sexo[:sexo_femenino].to_s,
Msip::Persona.convencion_sexo[:sexo_masculino].to_s,
Msip::Persona.convencion_sexo[:sexo_sininformacion].to_s,
],
message: "Sexó debe ser " +
Msip::Persona.convencion_sexo[:sexo_femenino].to_s + " o " +
Msip::Persona.convencion_sexo[:sexo_masculino].to_s + " o " +
Msip::Persona.convencion_sexo[:sexo_sininformacion].to_s,
}
end

scope :filtro_numerodocumento, lambda { |n|
where(
"unaccent(numerodocumento) ILIKE '%' || " +
"unaccent(?) || '%'",
n)
"unaccent(numerodocumento) ILIKE '%' || " +
"unaccent(?) || '%'",
n,
)
}

scope :filtro_tdocumento_id, lambda { |tid|
Expand Down
2 changes: 1 addition & 1 deletion lib/guiones/importavicini.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Dominio público de acuerdo a la legislación colombiana.
# [email protected] 2022

#u = Usuario.where(nusuario: "vtamara").take || Usuario.take
# u = Usuario.where(nusuario: "vtamara").take || Usuario.take

require "csv"

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/msip/control_acceso_basicas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def crear_registro(modelo, basica)

modulo_str = basica[0] + "::" + basica[1].capitalize
modelo = modulo_str.constantize
#muestra = modelo.all.sample
# muestra = modelo.all.sample

# No autenticado

Expand Down

0 comments on commit 7f8ea74

Please sign in to comment.