-
Notifications
You must be signed in to change notification settings - Fork 15
Standardize dates #46
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
base: master
Are you sure you want to change the base?
Conversation
bot/utils.py
Outdated
| "desea computar el gasto, con el formato dd/mm/yy." | ||
| return text | ||
| except User.DoesNotExist: | ||
| text = "El usuario espcificado ({}) no existe dentro de este grupo. \n".format(to_user) | ||
| text += "Los posibles usuarios a los que les podes cargar un pago son: \n" | ||
| async for member in group.users.exclude(pk=user.pk): | ||
| text += "- {}\n".format(member.username) | ||
| return text |
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.
El resultado de la función debería ser un dict, entiendo que para estos dos casos, en lugar de hacer return text se debería raisear el error esperado:
| "desea computar el gasto, con el formato dd/mm/yy." | |
| return text | |
| except User.DoesNotExist: | |
| text = "El usuario espcificado ({}) no existe dentro de este grupo. \n".format(to_user) | |
| text += "Los posibles usuarios a los que les podes cargar un pago son: \n" | |
| async for member in group.users.exclude(pk=user.pk): | |
| text += "- {}\n".format(member.username) | |
| return text | |
| "desea computar el gasto, con el formato dd/mm/yy." | |
| raise ParameterError(text) | |
| except User.DoesNotExist: | |
| text = "El usuario espcificado ({}) no existe dentro de este grupo. \n".format(to_user) | |
| text += "Los posibles usuarios a los que les podes cargar un pago son: \n" | |
| async for member in group.users.exclude(pk=user.pk): | |
| text += "- {}\n".format(member.username) | |
| raise ParameterError(text) |
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.
Si, se ve que hice un cambio de ultima momento y quedo mal esa parte. Ahí se agrega el lanzamiento de excepciones como bien sugeriste. Gracias @sofide !
Se adapto la solución para hacer la misma validaciones que se realizan en los gastos que en los pagos.
Creo que se podria refactorizar , ya que hay un poco de reutilización de codigo pero creo que como primera solución esta funcional.
Hice las pruebas sugeridas en el documento de testing funcional.
The solution has been customized to do the same validations that are done in expenses as in payments.
I think it could be refactored since there is some code reuse, but I think it is functional as a first solution.
I did the tests suggested in the functional testing document.
Related to #32