Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3533: Fixed getting track analysis; fixed display track info accordi… #21584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Corwin-Kh
Copy link
Contributor

…ng to join segments setting

@Corwin-Kh Corwin-Kh linked an issue Dec 18, 2024 that may be closed by this pull request
6 tasks
@@ -173,7 +174,6 @@ public void initItems(@Nullable GpxTrackAnalysis initAnalysis) {
withoutGaps = !selectedGpxFile.isJoinSegments()
&& (Algorithms.isEmpty(currentGpx.getTracks()) || currentGpx.getTracks().get(0).isGeneralTrack());
} else {
GpxDisplayItem displayItem = getDisplayItem();
if (displayItem != null) {
analysis = displayItem.analysis;
withoutGaps = !selectedGpxFile.isJoinSegments() && displayItem.isGeneralTrack();
Copy link
Member

@Chumva Chumva Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like copy-pasted logic, same as here

Comment on lines +256 to +260
private float getDistance(@NonNull TrackItem trackItem, @NonNull GpxTrackAnalysis analysis) {
GpxDataItem dataItem = trackItem.getDataItem();
boolean joinSegments = dataItem != null && (boolean) dataItem.getParameter(GpxParameter.JOIN_SEGMENTS);
return joinSegments ? analysis.getTotalDistance() : analysis.getTotalDistanceWithoutGaps();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need the same info in other places, we could add a universal method to GpxTrackAnalysis or TrackItem instead of UI

@@ -24,7 +24,6 @@ class GpxTrackAnalysis {
}

var name: String? = null
var totalDistanceWithoutGaps = 0f
var timeSpanWithoutGaps: Long = 0
var expectedRouteDuration: Long = 0
var timeMovingWithoutGaps: Long = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have the same issue with other variables here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have not faced such problems with others.

Comment on lines +455 to +457
if(splitSegments.size == 1 && !splitSegments[0].segment.isGeneralSegment()) {
totalDistanceWithoutGaps = totalDistance
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks strange. Is it needed because there are different values in totalDistance and totalDistanceWithoutGaps when we do not have multiple segments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. in case when we have only one segment we don't have "general segment" and totalDistanceWithoutGaps is not calculated, but it can be referenced in code

totalDistance = _totalDistance
if(splitSegments.size == 1 && !splitSegments[0].segment.isGeneralSegment()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Total track statistic in folder footer
3 participants