Open
Conversation
sofide
reviewed
Mar 25, 2025
bot/utils.py
Outdated
Comment on lines
221
to
228
| "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 |
Owner
There was a problem hiding this comment.
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:
Suggested change
| "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) |
Author
There was a problem hiding this comment.
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 !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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