-
-
Save anonymous/2ab33c376db46ee19101 to your computer and use it in GitHub Desktop.
This file contains 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
def validate() | |
balance = @mysql.query("SELECT Balance FROM Balance WHERE AccountID = #{@sender_id} ORDER BY Date DESC LIMIT 1") | |
if balance >= @amount | |
return true | |
else | |
return false | |
end | |
end | |
# Esegue il bonifico con una query MySQL | |
def do() | |
if self.validate | |
@mysql.query("CALL Transfer(#{@sender_id}, #{@recipient_id}, #{@amount})") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rather than the whole if statement with
return true
andreturn false
just: