Skip to content

Commit

Permalink
sepinf-inc#2286: fix longitude and better handling lat,lon
Browse files Browse the repository at this point in the history
  • Loading branch information
aberenguel committed Oct 28, 2024
1 parent 23ab114 commit a479b0a
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,23 @@ private String formatLocation(Message message) {
if ((lat == null || lon == null) && localization != null) {
String coord = localization.getLocations();
String[] coordSplit = coord.split(";");
lat = StringUtils.firstNonBlank(lat, coordSplit[0]);
lon = StringUtils.firstNonBlank(lat, coordSplit[1]);
if (coordSplit.length == 2) {
lat = coordSplit[0];
lon = coordSplit[1];
}
}

lat = StringUtils.replace(lat, ",", ".");
lon = StringUtils.replace(lon, ",", ".");

DivTag div = div(img(attrs(".location")), b(Messages.getString("UfedChatReport.Location.Title")), br());

if (!StringUtils.isAllBlank(lat, lon)) {
div.with(table(attrs(".contact-table"), //
tr(td(Messages.getString("UfedChatReport.Location.Latitude")), td(lat)), //
tr(td(Messages.getString("UfedChatReport.Location.Longitude")), td(lon))), //
br());
}

lat = StringUtils.defaultString(lat).replace(",", ".");
lon = StringUtils.defaultString(lon).replace(",", ".");

DivTag div = div(img(attrs(".location")), b(Messages.getString("UfedChatReport.Location.Title")), br(),
table(attrs(".contact-table"), //
tr(td(Messages.getString("UfedChatReport.Location.Latitude")), td(lat)),
tr(td(Messages.getString("UfedChatReport.Location.Longitude")), td(lon))),
br());

if (localization != null) {
String name = localization.getName();
Expand Down

0 comments on commit a479b0a

Please sign in to comment.