Skip to content

Commit e43c9d5

Browse files
committed
fix: fixed error on calibration collection load + update toolbar btn name for home
1 parent e738c06 commit e43c9d5

3 files changed

Lines changed: 47 additions & 16 deletions

File tree

package-lock.json

Lines changed: 29 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/general/Toolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</div>
66
<v-spacer />
77
<v-btn text dark to="/" v-if="$route.name != 'Dashboard'">
8-
{{ $route.name != 'Login' ? 'Calibration' : 'Home' }}
8+
Home
99
</v-btn>
1010
<!-- <v-btn
1111
text

src/store/calibration.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export default {
217217
state.runtime.usedPattern.forEach((p) => {
218218
const data =
219219
predictions[p.x.toString().split(".")[0]][
220-
p.y.toString().split(".")[0]
220+
p.y.toString().split(".")[0]
221221
];
222222

223223
p.precision = Number(data.PrecisionSD).toFixed(2);
@@ -258,21 +258,25 @@ export default {
258258
.get();
259259

260260
const calibrations = [];
261-
calibrationsCollection.forEach((doc) => {
261+
calibrationsCollection.docs.forEach((doc) => {
262262
var averageAccuracy = 0;
263263
var averagePrecision = 0;
264264
var data = doc.data();
265-
data.pattern.forEach((element) => {
266-
averageAccuracy += Number(element.accuracy);
267-
averagePrecision += Number(element.precision);
268-
});
269-
data.averageAccuracy = averageAccuracy / data.pattern.length;
270-
data.averagePrecision = averagePrecision / data.pattern.length;
271-
calibrations.push({
272-
id: doc.id,
273-
model: doc.data().models,
274-
...data,
275-
});
265+
266+
if (data.pattern) {
267+
data.pattern.forEach((element) => {
268+
averageAccuracy += Number(element.accuracy);
269+
averagePrecision += Number(element.precision);
270+
});
271+
272+
data.averageAccuracy = averageAccuracy / data.pattern.length;
273+
data.averagePrecision = averagePrecision / data.pattern.length;
274+
calibrations.push({
275+
id: doc.id,
276+
model: doc.data().models,
277+
...data,
278+
});
279+
}
276280
});
277281

278282
commit("setCalibrations", calibrations);

0 commit comments

Comments
 (0)