Fix environment metrics log

This commit is contained in:
Garth Vander Houwen 2023-04-05 21:26:53 -07:00
parent 1851e96e7a
commit 4c25e8a589
3 changed files with 5 additions and 4 deletions

View file

@ -121,9 +121,10 @@ struct MapViewSwiftUI: UIViewRepresentable {
.filter { $0.latest == true }
.sorted { $0.nodePosition?.num ?? 0 > $1.nodePosition?.num ?? -1 }
let annotationCount = waypoints.count + (showNodeHistory ? positions.count : latest.count)
print("Annotation Count: \(annotationCount) Map Annotations: \(mapView.annotations.count)")
if annotationCount != mapView.annotations.count {
print("Annotation Count: \(annotationCount) Map Annotations: \(mapView.annotations.count)")
mapView.removeAnnotations(mapView.annotations)
mapView.addAnnotations(waypoints)
if showRouteLines {

View file

@ -190,7 +190,7 @@ struct DeviceMetricsLog: View {
}
}
Button {
exportString = telemetryToCsvFile(telemetry: node.telemetries!.array as? [TelemetryEntity] ?? [], metricsType: 0)
exportString = telemetryToCsvFile(telemetry: deviceMetrics, metricsType: 0)
isExporting = true
} label: {
Label("save", systemImage: "square.and.arrow.down")

View file

@ -79,7 +79,7 @@ struct EnvironmentMetricsLog: View {
.font(.caption)
.fontWeight(.bold)
}
ForEach(node.telemetries?.reversed() as? [TelemetryEntity] ?? [], id: \.self) { (em: TelemetryEntity) in
ForEach(environmentMetrics, id: \.self) { em in
GridRow {
@ -124,7 +124,7 @@ struct EnvironmentMetricsLog: View {
}
}
Button {
exportString = telemetryToCsvFile(telemetry: node.telemetries!.array as? [TelemetryEntity] ?? [], metricsType: 1)
exportString = telemetryToCsvFile(telemetry: environmentMetrics, metricsType: 1)
isExporting = true
} label: {
Label("save", systemImage: "square.and.arrow.down")