Skip to content

Colota - Android GPS Location tracker

fix(inspector): correct battery status taxonomy and tighten data table headers

Max Dietrich5f4f7f31501c
diff --git a/apps/mobile/src/components/features/inspector/LocationTable.tsx b/apps/mobile/src/components/features/inspector/LocationTable.tsx
index 745e9885..26f3147d 100644
--- a/apps/mobile/src/components/features/inspector/LocationTable.tsx
+++ b/apps/mobile/src/components/features/inspector/LocationTable.tsx
@@ -26,12 +26,12 @@ function val(v?: number | null, decimals = 0): string {
return decimals > 0 ? v.toFixed(decimals) : String(Math.round(v))
}
+// Mirrors BatteryStatus.kt.
const BATTERY_STATUS: Record<number, string> = {
- 1: "Unknown",
+ 0: "Unknown",
+ 1: "Discharging",
2: "Charging",
- 3: "Discharging",
- 4: "Not charging",
- 5: "Full"
+ 3: "Full"
}
const LocationRow = React.memo(
@@ -49,7 +49,7 @@ const LocationRow = React.memo(
{item.timestamp ? formatTime(item.timestamp, true) : "-"}
</Text>
<Text style={[styles.cell, styles.cellNum, { color: colors.textSecondary }]} numberOfLines={1}>
- {item.delta != null ? `+${item.delta}s` : ""}
+ {item.delta != null ? `+${item.delta}` : ""}
</Text>
<Text style={[styles.cell, styles.cellCoord, { color: colors.text }]} numberOfLines={1}>
{val(item.latitude, 5)}
@@ -133,7 +133,7 @@ export function LocationTable({ locations, colors }: Props) {
<Text style={[styles.cell, styles.cellNum, styles.headerText, { color: colors.textSecondary }]}>Bear</Text>
<Text style={[styles.cell, styles.cellNum, styles.headerText, { color: colors.textSecondary }]}>Batt</Text>
<Text style={[styles.cell, styles.cellStatus, styles.headerText, { color: colors.textSecondary }]}>
- Status
+ Charge
</Text>
</View>
diff --git a/apps/mobile/src/components/features/inspector/__tests__/LocationTable.test.tsx b/apps/mobile/src/components/features/inspector/__tests__/LocationTable.test.tsx
index aeaf46c0..247b6076 100644
--- a/apps/mobile/src/components/features/inspector/__tests__/LocationTable.test.tsx
+++ b/apps/mobile/src/components/features/inspector/__tests__/LocationTable.test.tsx
@@ -43,7 +43,7 @@ const locations: LocationCoords[] = [
speed: 8,
bearing: 180,
battery: 79,
- battery_status: 3
+ battery_status: 1
},
{
latitude: 48.3,
@@ -81,7 +81,7 @@ describe("LocationTable", () => {
expect(getByText("Alt")).toBeTruthy()
expect(getByText("Bear")).toBeTruthy()
expect(getByText("Batt")).toBeTruthy()
- expect(getByText("Status")).toBeTruthy()
+ expect(getByText("Charge")).toBeTruthy()
})
it("renders location rows with correct values", () => {
@@ -126,7 +126,7 @@ describe("LocationTable", () => {
// index 2 (ts=1060): delta = 1060 - 1030 = 30
// After reverse: [index2, index1, index0]
// Both index2 and index1 have delta = 30, index0 has delta = null
- const deltaElements = getAllByText("+30s")
+ const deltaElements = getAllByText("+30")
expect(deltaElements.length).toBe(2)
})
@@ -144,7 +144,6 @@ describe("LocationTable", () => {
it("shows battery status text (Charging, Discharging, etc.)", () => {
const { getByText } = render(<LocationTable locations={locations} colors={mockColors} />)
- // battery_status 2 = "Charging", battery_status 3 = "Discharging"
expect(getByText("Charging")).toBeTruthy()
expect(getByText("Discharging")).toBeTruthy()
})