Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Last active July 12, 2017 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salsalabs/7e8303e3a7b492039e97f8640f731457 to your computer and use it in GitHub Desktop.
Save salsalabs/7e8303e3a7b492039e97f8640f731457 to your computer and use it in GitHub Desktop.
SalsaScript to retrieve the most recent donation and make it look like a real number (e.g. a donation of 5 looks like 5.00).
<p><?
(function() {
amount = "0.00";
try {
_donations = supporter.getObjects('donation', {
orderBy: [ '-TransactionDate' ],
limit: 1
});
if (_donations != null && _donations.length != 0) {
amount = parseFloat(_donations[0].amount).toFixed(2);
}
} catch(e){
}
})();
?></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment