Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sugestões #24

Merged
merged 3 commits into from
Jan 12, 2021
Merged

Sugestões #24

merged 3 commits into from
Jan 12, 2021

Conversation

brunorafa
Copy link
Contributor

Abri esse PR mais no intuito de propor algumas sugestões de mudança e evoluir algumas discussões. :)

Comment on lines +9 to +11
|> rem(mod_factor)
|> (&(mod_factor - &1)).()
|> rem(mod_factor)
Copy link
Contributor Author

@brunorafa brunorafa Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

achei bem interessante a estrategia de passar o rem(mod_factor) novamente para evitar que o resultado tenha mais de 1 digito, mas aparentemente só funciona para mod_factor = 10.

iex(30)> rem(10, 10)
0
iex(31)> rem(4, 10)
4
iex(32)> rem(10, 11)
10 <--- isso seria um problema pois não deveria existir um digito verificador de 2 digitos
iex(33)> rem(2, 11)
2
iex(34)> rem(11, 11)
0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm.. isso pode virar um problema pro banco do brasil.
vou criar uma issue pra refatorar isso :)


validating_digit =
full_account_number
|> DigitCalculator.calc_numbers(@weigths, false)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parecia que o Itau e o santander estavam querendo fazer coisas bem parecidas com uma minima variação em relação a somar os digitos ou nao do resultado.

@brunorafa brunorafa closed this Dec 18, 2020
@brunorafa brunorafa reopened this Jan 8, 2021
Copy link
Contributor

@itsmegrave itsmegrave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunorafa, só altera a versão do pacote no mix.exs :)

@itsmegrave itsmegrave merged commit b6a6a71 into master Jan 12, 2021
@itsmegrave itsmegrave deleted the maybe_minor_improvements branch January 12, 2021 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants