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

Fixed dif stat #4102

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,22 +284,25 @@ - (void)updateGpxData:(BOOL)replaceGPX updateDocument:(BOOL)updateDocument
}
}


- (OASGpxTrackAnalysis *)getAnalysisFor:(OASTrkSegment *)segment
{
OASGpxTrackAnalysis *analysis = [[OASGpxTrackAnalysis alloc] init];
auto splitSegments = [ArraySplitSegmentConverter toKotlinArrayFrom:@[[[OASSplitSegment alloc] initWithSegment:segment]]];
[analysis prepareInformationFileTimeStamp:0 pointsAnalyser:nil splitSegments:splitSegments];
return analysis;
}

- (void)updateAnalysis
{
if (_doc)
{
_analysis = !_isCurrentTrack && [_doc getGeneralTrack] && [_doc getGeneralSegment]
? [self getAnalysisFor:[_doc getGeneralSegment]]
: [_doc getAnalysisFileTimestamp:0 fromDistance:nil toDistance:nil pointsAnalyzer:OASPlatformUtil.shared.getTrackPointsAnalyser];
NSString *gpxFilePath = _doc.path;
NSTimeInterval fileTimestamp;
if (gpxFilePath.length == 0)
{
fileTimestamp = [[NSDate date] timeIntervalSince1970] * 1000;
}
else
{
OASKFile *file = [[OASKFile alloc] initWithFilePath:gpxFilePath];
fileTimestamp = file.lastModified;
}
_analysis = [_doc getAnalysisFileTimestamp:fileTimestamp fromDistance:nil toDistance:nil pointsAnalyzer:OASPlatformUtil.shared.getTrackPointsAnalyser];
if (_analysis.totalDistanceWithoutGaps == 0 && _analysis.totalDistance != 0)
// Set _analysis.totalDistanceWithoutGaps to _analysis.totalDistance because the initial analysis does not compute totalDistanceWithoutGaps for tracks with multiple segments during this initialization.
_analysis.totalDistanceWithoutGaps = _analysis.totalDistance;
Copy link
Contributor

Choose a reason for hiding this comment

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

it needs to be fixed

}
else
{
Expand Down