mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-04 10:23:06 +02:00
Update stats waypoint calorie when changing activity type
This commit is contained in:
+6
-1
@@ -394,6 +394,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
int elevationGainIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.ELEVATIONGAIN);
|
||||
int minGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MINGRADE);
|
||||
int maxGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MAXGRADE);
|
||||
int calorieIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.CALORIE);
|
||||
int photoUrlIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.PHOTOURL);
|
||||
|
||||
Waypoint waypoint = new Waypoint();
|
||||
@@ -496,7 +497,10 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
tripStatistics.setMaxGrade(cursor.getFloat(maxGradeIndex));
|
||||
hasTripStatistics = true;
|
||||
}
|
||||
|
||||
if (!cursor.isNull(calorieIndex)) {
|
||||
tripStatistics.setCalorie(cursor.getFloat(calorieIndex));
|
||||
hasTripStatistics = true;
|
||||
}
|
||||
if (hasTripStatistics) {
|
||||
waypoint.setTripStatistics(tripStatistics);
|
||||
}
|
||||
@@ -739,6 +743,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
values.put(WaypointsColumns.ELEVATIONGAIN, tripStatistics.getTotalElevationGain());
|
||||
values.put(WaypointsColumns.MINGRADE, tripStatistics.getMinGrade());
|
||||
values.put(WaypointsColumns.MAXGRADE, tripStatistics.getMaxGrade());
|
||||
values.put(WaypointsColumns.CALORIE, tripStatistics.getCalorie());
|
||||
}
|
||||
|
||||
values.put(WaypointsColumns.PHOTOURL, waypoint.getPhotoUrl());
|
||||
|
||||
@@ -124,7 +124,7 @@ public interface TracksColumns extends BaseColumns {
|
||||
+ MODIFIEDTIME + " INTEGER, " // modified time
|
||||
+ SHAREDWITHME + " INTEGER, " // shared with me
|
||||
+ SHAREDOWNER + " STRING, " // shared owner
|
||||
+ CALORIE + " INTEGER);"; // calorie
|
||||
+ CALORIE + " FLOAT);"; // calorie
|
||||
|
||||
public static final String[] COLUMNS = { _ID, // id
|
||||
NAME, // name
|
||||
@@ -190,6 +190,6 @@ public interface TracksColumns extends BaseColumns {
|
||||
ContentTypeIds.LONG_TYPE_ID, // modified time
|
||||
ContentTypeIds.BOOLEAN_TYPE_ID, // shared with me
|
||||
ContentTypeIds.STRING_TYPE_ID, // shared owner
|
||||
ContentTypeIds.INT_TYPE_ID // calorie
|
||||
ContentTypeIds.FLOAT_TYPE_ID // calorie
|
||||
};
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ public interface WaypointsColumns extends BaseColumns {
|
||||
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
public static final String MINGRADE = "mingrade"; // min grade
|
||||
public static final String MAXGRADE = "maxgrade"; // max grade
|
||||
|
||||
public static final String CALORIE = "calorie"; // calorie
|
||||
|
||||
public static final String PHOTOURL = "photoUrl"; // url for the photo
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
@@ -104,6 +105,7 @@ public interface WaypointsColumns extends BaseColumns {
|
||||
+ ELEVATIONGAIN + " FLOAT, "
|
||||
+ MINGRADE + " FLOAT, "
|
||||
+ MAXGRADE + " FLOAT, "
|
||||
+ CALORIE + " FLOAT, "
|
||||
+ PHOTOURL + " STRING"
|
||||
+ ");";
|
||||
|
||||
@@ -138,6 +140,7 @@ public interface WaypointsColumns extends BaseColumns {
|
||||
ELEVATIONGAIN,
|
||||
MINGRADE,
|
||||
MAXGRADE,
|
||||
CALORIE,
|
||||
PHOTOURL
|
||||
};
|
||||
|
||||
@@ -172,6 +175,7 @@ public interface WaypointsColumns extends BaseColumns {
|
||||
FLOAT_TYPE_ID, // elevation gain
|
||||
FLOAT_TYPE_ID, // min grade
|
||||
FLOAT_TYPE_ID, // max grade
|
||||
FLOAT_TYPE_ID, // calorie
|
||||
STRING_TYPE_ID // photo url
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user