Skip to content

Commit

Permalink
Merge branch 'fixBugLastReading' into 'development'
Browse files Browse the repository at this point in the history
Fix bug on last reading time

See merge request lappis-unb/projects/SMI/smi-mobile!18
  • Loading branch information
alaxalves committed Mar 30, 2020
2 parents 7a6d097 + e823206 commit d42b1ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/pages/Transducer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -211,7 +212,7 @@ export default {
},
getTime (d) {
let ans = timePassed(d)
if (ans !== 'agora') {
if (ans !== 'agora' && ans !== 'indeterminado') {
ans = '' + ans
}
return ans
Expand Down
4 changes: 3 additions & 1 deletion src/utils/timePassed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

0 comments on commit d42b1ea

Please sign in to comment.