Skip to content

Commit

Permalink
Merge pull request #39 from dadosjusbr/nome_sanitizado
Browse files Browse the repository at this point in the history
adicionando coluna nome_sanitizado
  • Loading branch information
joellensilva authored Jun 17, 2024
2 parents cd1ac7a + 0d65346 commit 98aaedd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/dadosjusbr/proto v0.0.0-20221212025627-91c60aa3cd12
github.com/dadosjusbr/storage v0.0.0-20240514131514-43ac5da3ae8a
github.com/dadosjusbr/storage v0.0.0-20240617171357-618f39b02d6f
github.com/kelseyhightower/envconfig v1.4.0
google.golang.org/protobuf v1.28.1
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ github.com/dadosjusbr/storage v0.0.0-20240315221019-5da10c81ab80 h1:mo6k/MAl6aF6
github.com/dadosjusbr/storage v0.0.0-20240315221019-5da10c81ab80/go.mod h1:PszGy6CDoG3kNLjIsCmwD3MAWED7xL7U/OWj7ajsiHc=
github.com/dadosjusbr/storage v0.0.0-20240514131514-43ac5da3ae8a h1:1LyzfsNzKgLjC4/cyQr+N724a4dcRCHB5yIauAnhhcI=
github.com/dadosjusbr/storage v0.0.0-20240514131514-43ac5da3ae8a/go.mod h1:rIM/dbZMdrMfVnZgNgRNRRtsxfhSMH8S8X7MZEeKkrQ=
github.com/dadosjusbr/storage v0.0.0-20240617171357-618f39b02d6f h1:56frC4wo/iyKmCe/5+HvKZn5AS3fFc0KDXm/DMij8kA=
github.com/dadosjusbr/storage v0.0.0-20240617171357-618f39b02d6f/go.mod h1:rIM/dbZMdrMfVnZgNgRNRRtsxfhSMH8S8X7MZEeKkrQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
31 changes: 16 additions & 15 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,21 @@ func main() {
for id, p := range er.Rc.Folha.ContraCheque {
salary, benefits, discounts, remuneration := calcBaseSalary(*p)
paychecks = append(paychecks, models.Paycheck{
ID: id + 1,
Agency: er.Rc.Coleta.Orgao,
Month: int(er.Rc.Coleta.Mes),
Year: int(er.Rc.Coleta.Ano),
CollectKey: er.Rc.Coleta.ChaveColeta,
Name: p.Nome,
RegisterID: p.Matricula,
Role: p.Funcao,
Workplace: p.LocalTrabalho,
Salary: salary,
Benefits: benefits,
Discounts: discounts,
Remuneration: remuneration,
Situation: ativoInativo(p.Ativo, er.Rc.Coleta.Orgao),
ID: id + 1,
Agency: er.Rc.Coleta.Orgao,
Month: int(er.Rc.Coleta.Mes),
Year: int(er.Rc.Coleta.Ano),
CollectKey: er.Rc.Coleta.ChaveColeta,
Name: p.Nome,
RegisterID: p.Matricula,
Role: p.Funcao,
Workplace: p.LocalTrabalho,
Salary: salary,
Benefits: benefits,
Discounts: discounts,
Remuneration: remuneration,
Situation: ativoInativo(p.Ativo, er.Rc.Coleta.Orgao),
SanitizedName: sanitizarItem(p.Nome),
})
// Detalhamento das despesas
i := 1
Expand Down Expand Up @@ -327,7 +328,7 @@ func ativoInativo(ativo bool, orgao string) *string {
}
}

// Sanitizando as rubricas:
// Sanitizando as rubricas e nomes:
// deixando-as em minúsculo, sem acentos, pontuações, caracteres especiais e espaços duplos
func sanitizarItem(item string) string {
// Converte para minúsculas
Expand Down

0 comments on commit 98aaedd

Please sign in to comment.