diff --git a/src/pages/Transducer.vue b/src/pages/Transducer.vue index dfca317..6e13d09 100644 --- a/src/pages/Transducer.vue +++ b/src/pages/Transducer.vue @@ -151,7 +151,8 @@ export default { r: Math.round(res.data[0].total_reactive_power), t: Math.round(res.data[0].total_power_factor) } - this.lastReading = this.getTime(res.data.collection_time) + + this.lastReading = this.getTime(res.data[0].collection_date) this.hasMeasurements = true }) .catch(err => { @@ -211,7 +212,7 @@ export default { }, getTime (d) { let ans = timePassed(d) - if (ans !== 'agora') { + if (ans !== 'agora' && ans !== 'indeterminado') { ans = 'há ' + ans } return ans diff --git a/src/utils/timePassed.js b/src/utils/timePassed.js index 71e6169..1736409 100644 --- a/src/utils/timePassed.js +++ b/src/utils/timePassed.js @@ -14,7 +14,9 @@ export default function timePassed (time) { return h + 'h ' + m + 'min' } } - } else { + } else if (time !== undefined && time !== null) { return 'agora' + } else { + return 'indeterminado' } }