aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-13 20:56:55 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-13 20:56:55 -0600
commit64f2d3cd5619d6a7dccbaa08aeabca9c8b350a43 (patch)
treeb9e6e7647112090cbade4efc4099e8537bf2e27a
parent16874b7ecf74d18c74087d76d68c5e963f137d8f (diff)
downloadetbsa-trackermap-mobile-64f2d3cd5619d6a7dccbaa08aeabca9c8b350a43.tar.gz
etbsa-trackermap-mobile-64f2d3cd5619d6a7dccbaa08aeabca9c8b350a43.tar.bz2
etbsa-trackermap-mobile-64f2d3cd5619d6a7dccbaa08aeabca9c8b350a43.zip
Fixed stops report
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt4
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MarkerTransformations.kt8
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Stop.kt18
3 files changed, 17 insertions, 13 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt
index 851516e..8db7cda 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt
@@ -127,7 +127,9 @@ class UnitReportsViewModel(
Log.d("UnitReportsVM", "Current date:${dateFormat.format(currentDate)}")
Log.d("UnitReportsVM", "Previous date:${dateFormat.format(previousDate)}")
- _report.postValue(Report.LoadingReport)
+ if (!xlsx) {
+ _report.postValue(Report.LoadingReport)
+ }
viewModelScope.launch {
when (_reportType.value!!) {
ReportType.POSITIONS -> fetchPositions(previousDate, currentDate, xlsx)
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MarkerTransformations.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MarkerTransformations.kt
index e77471b..933cd8a 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MarkerTransformations.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MarkerTransformations.kt
@@ -1,5 +1,6 @@
package mx.trackermap.TrackerMap.android.map
+import android.util.Log
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.client.models.Position
import mx.trackermap.TrackerMap.client.models.Stop
@@ -35,15 +36,16 @@ object MarkerTransformations {
}
fun stopToMarker(stop: Stop): MapFragment.Marker? {
- if (stop.lat == null || stop.lon == null) {
+ Log.d("MarkerTransformations", "stopToMarker($stop)")
+ if (stop.latitude == null || stop.longitude == null) {
return null
}
return MapFragment.Marker(
stop.deviceId!!,
stop.deviceName!!,
- stop.lat!!,
- stop.lon!!
+ stop.latitude!!,
+ stop.longitude!!
)
}
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Stop.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Stop.kt
index c06b864..7ec1066 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Stop.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Stop.kt
@@ -21,8 +21,8 @@ import kotlinx.serialization.Serializable
* @param duration
* @param startTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param address
- * @param lat
- * @param lon
+ * @param latitude
+ * @param longitude
* @param endTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param spentFuel in liters
* @param engineHours
@@ -30,18 +30,18 @@ import kotlinx.serialization.Serializable
@Serializable
data class Stop (
- val deviceId: kotlin.Int? = null,
- val deviceName: kotlin.String? = null,
- val duration: kotlin.Int? = null,
+ val deviceId: Int? = null,
+ val deviceName: String? = null,
+ val duration: Int? = null,
/* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */
val startTime: String? = null,
- val address: kotlin.String? = null,
- val lat: Double? = null,
- val lon: Double? = null,
+ val address: String? = null,
+ val latitude: Double? = null,
+ val longitude: Double? = null,
/* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */
val endTime: String? = null,
/* in liters */
val spentFuel: Double? = null,
- val engineHours: kotlin.Int? = null
+ val engineHours: Int? = null
) {
} \ No newline at end of file