Don't display "null" as activity location in UI when reverse geocoding didn't took place (#3)
* Fix display of "null" for activity location (backend) * Fix display of "null" for activity location (frontend) --------- Co-authored-by: Niklas Deutschmann <sonstharmlos@noreply.codeberg.org>
This commit is contained in:
parent
fb440b2b8f
commit
5f85417c80
5 changed files with 10 additions and 6 deletions
|
|
@ -133,7 +133,7 @@ public class ActivityDTO {
|
||||||
.elevationLoss(activity.getElevationLoss())
|
.elevationLoss(activity.getElevationLoss())
|
||||||
.createdAt(activity.getCreatedAt())
|
.createdAt(activity.getCreatedAt())
|
||||||
.updatedAt(activity.getUpdatedAt())
|
.updatedAt(activity.getUpdatedAt())
|
||||||
.activityLocation(activity.getActivityLocation());
|
.activityLocation(activity.getActivityLocationNonNull());
|
||||||
|
|
||||||
if (activity.getTotalDurationSeconds() != null) {
|
if (activity.getTotalDurationSeconds() != null) {
|
||||||
builder.totalDurationSeconds(activity.getTotalDurationSeconds());
|
builder.totalDurationSeconds(activity.getTotalDurationSeconds());
|
||||||
|
|
@ -246,7 +246,7 @@ public class ActivityDTO {
|
||||||
.subSport(activity.getSubSport())
|
.subSport(activity.getSubSport())
|
||||||
.indoorDetectionMethod(activity.getIndoorDetectionMethod())
|
.indoorDetectionMethod(activity.getIndoorDetectionMethod())
|
||||||
.race(activity.getRace() != null ? activity.getRace() : false)
|
.race(activity.getRace() != null ? activity.getRace() : false)
|
||||||
.activityLocation(activity.getActivityLocation())
|
.activityLocation(activity.getActivityLocationNonNull())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,7 +266,7 @@ public class ActivityDTO {
|
||||||
.elevationLoss(activity.getElevationLoss())
|
.elevationLoss(activity.getElevationLoss())
|
||||||
.createdAt(activity.getCreatedAt())
|
.createdAt(activity.getCreatedAt())
|
||||||
.updatedAt(activity.getUpdatedAt())
|
.updatedAt(activity.getUpdatedAt())
|
||||||
.activityLocation(activity.getActivityLocation());
|
.activityLocation(activity.getActivityLocationNonNull());
|
||||||
|
|
||||||
if (activity.getTotalDurationSeconds() != null) {
|
if (activity.getTotalDurationSeconds() != null) {
|
||||||
builder.totalDurationSeconds(activity.getTotalDurationSeconds());
|
builder.totalDurationSeconds(activity.getTotalDurationSeconds());
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class TimelineActivityDTO {
|
||||||
.indoorDetectionMethod(activity.getIndoorDetectionMethod())
|
.indoorDetectionMethod(activity.getIndoorDetectionMethod())
|
||||||
.race(activity.getRace() != null ? activity.getRace() : false)
|
.race(activity.getRace() != null ? activity.getRace() : false)
|
||||||
.metrics(activity.getMetrics() != null ? ActivityMetricsSummary.fromMetrics(activity.getMetrics()) : null)
|
.metrics(activity.getMetrics() != null ? ActivityMetricsSummary.fromMetrics(activity.getMetrics()) : null)
|
||||||
.activityLocation(activity.getActivityLocation())
|
.activityLocation(activity.getActivityLocationNonNull())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,10 @@ public class Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getActivityLocationNonNull() {
|
||||||
|
return activityLocation != null ? activityLocation : "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity types supported by the platform
|
* Activity types supported by the platform
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class TimelineResultMapper {
|
||||||
.commentsCount(commentsCount)
|
.commentsCount(commentsCount)
|
||||||
.likedByCurrentUser(likedByCurrentUser)
|
.likedByCurrentUser(likedByCurrentUser)
|
||||||
.hasGpsTrack(true) // Will be refined based on actual data
|
.hasGpsTrack(true) // Will be refined based on actual data
|
||||||
.activityLocation(activityLocation)
|
.activityLocation(activityLocation != null ? activityLocation : "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ const FitPubTimeline = {
|
||||||
@${this.escapeHtml(activity.username)}
|
@${this.escapeHtml(activity.username)}
|
||||||
</a>
|
</a>
|
||||||
${!activity.isLocal ? ' <span class="badge bg-info ms-1" title="Federated Activity"><i class="bi bi-globe2"></i> Remote</span>' : ''}
|
${!activity.isLocal ? ' <span class="badge bg-info ms-1" title="Federated Activity"><i class="bi bi-globe2"></i> Remote</span>' : ''}
|
||||||
• ${this.formatTimeAgo(activity.startedAt)} • ${activity.activityLocation}
|
• ${this.formatTimeAgo(activity.startedAt)} ${activity.activityLocation ? '•' : ''} ${activity.activityLocation}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue