mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: fix identification of relevant FitDiveSummary session record
The logic depended on the sequence of records and not their actual content.
This commit is contained in:
committed by
José Rebelo
parent
4da08f7968
commit
5b2f982509
+14
-3
@@ -209,12 +209,23 @@ public class GarminWorkoutParser implements ActivitySummaryParser {
|
||||
// We only support 1 user profile
|
||||
userProfile = (FitUserProfile) record;
|
||||
}
|
||||
} else if (record instanceof FitDiveSummary) {
|
||||
} else if (record instanceof FitDiveSummary newDiveSummary) {
|
||||
LOG.trace("Dive summary: {}", record);
|
||||
if (diveSummary != null) {
|
||||
return false; // for some reason there is more than one message, in my activities the first one contains all data
|
||||
Integer referenceMesg = newDiveSummary.getReferenceMesg();
|
||||
if(referenceMesg != null && referenceMesg != 18){
|
||||
// prioritize diving session (18) over records like diving laps (19)
|
||||
// wish list for apnea diving: parse the multiple laps (19)
|
||||
return false;
|
||||
}
|
||||
|
||||
Integer referenceIndex = newDiveSummary.getReferenceIndex();
|
||||
if(referenceIndex != null && referenceIndex != 0){
|
||||
// prioritize first session/lap over other session/lap
|
||||
return false;
|
||||
}
|
||||
}
|
||||
diveSummary = (FitDiveSummary) record;
|
||||
diveSummary = newDiveSummary;
|
||||
} else if (record instanceof FitDiveGas) {
|
||||
LOG.trace("Dive gas: {}", record);
|
||||
diveGases.add((FitDiveGas) record);
|
||||
|
||||
Reference in New Issue
Block a user