-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sugestões #24
Conversation
|> rem(mod_factor) | ||
|> (&(mod_factor - &1)).() | ||
|> rem(mod_factor) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 :)
Abri esse PR mais no intuito de propor algumas sugestões de mudança e evoluir algumas discussões. :)