fix all clear notification

This commit is contained in:
Josh Harvey 2016-12-12 18:18:26 +02:00
parent 77f487c03c
commit a4b35bab05
2 changed files with 16 additions and 11 deletions

View file

@ -162,7 +162,7 @@ function emailAlert (alert) {
const stuckAge = prettyMs(alert.age, {compact: true, verbose: true})
return 'Machine is stuck on ' + alert.state + 'screen for ' + stuckAge
case 'lowBalance':
const balance = formatCurrency(alert.fiatBalance, alert.fiatCode)
const balance = formatCurrency(alert.fiatBalance.balance, alert.fiatCode)
return 'Low balance of ' + balance + ' in ' + alert.cryptoCode + ' wallet'
}
}
@ -190,10 +190,13 @@ function printEmailAlerts (alertRec) {
function alertSubject (alertRec) {
let alerts = alertRec.general
R.keys(alertRec.devices).forEach(function (device) {
alerts = R.concat(alerts, alertRec.devices[device])
})
if (alerts.length === 0) return null
const alertTypes = R.uniq(R.pluck('code', alerts)).sort()
return '[Lamassu] Errors reported: ' + alertTypes.join(', ')
}