Pointed data set at new module
This commit is contained in:
parent
91321766cc
commit
9b244e1d72
@ -42,7 +42,7 @@ export class BatteryService {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.firestore = firebaseApp.firestore();
|
this.firestore = firebaseApp.firestore();
|
||||||
this.firestore.settings({timestampsInSnapshots: true});
|
this.firestore.settings({timestampsInSnapshots: true});
|
||||||
this.firestore.collection('Battery').doc('170724D').onSnapshot(snap => {
|
this.firestore.collection('Battery').doc('170614D').onSnapshot(snap => {
|
||||||
this.last = new Date();
|
this.last = new Date();
|
||||||
let data = snap.data();
|
let data = snap.data();
|
||||||
this.batteries = Object.keys(data.modules).map(key => {
|
this.batteries = Object.keys(data.modules).map(key => {
|
||||||
@ -56,6 +56,7 @@ export class BatteryService {
|
|||||||
tempHistory: data.modules[key].map((val, i) => ({name: i, value: val.temp}))
|
tempHistory: data.modules[key].map((val, i) => ({name: i, value: val.temp}))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.total = this.batteries.reduce((acc, battery) => acc + battery.charge, 0) / 2;
|
this.total = this.batteries.reduce((acc, battery) => acc + battery.charge, 0) / 2;
|
||||||
|
|
||||||
console.log(this.batteries)
|
console.log(this.batteries)
|
||||||
|
Loading…
Reference in New Issue
Block a user