Skip to content

Commit

Permalink
Merge pull request #3392 from ProjectSidewalk/3390-neighborhood-csv-e…
Browse files Browse the repository at this point in the history
…rror

Fixed neighborhood name commas breaking csv formatting
  • Loading branch information
misaugstad authored Oct 4, 2023
2 parents e220032 + 9ac177b commit 08dcc06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/ProjectSidewalkAPIController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,14 @@ class ProjectSidewalkAPIController @Inject()(implicit val env: Environment[User,
val coordinates: Array[Coordinate] = geom.getCoordinates
val coordStr: String = "\"[" + coordinates.map(c => "(" + c.x + "," + c.y + ")").mkString(",") + "]\""
if (region.coverage > 0.0D) {
writer.println(region.name + "," + region.regionID + "," + region.score + "," + coordStr + "," +
writer.println("\"" + region.name + "\"," + region.regionID + "," + region.score + "," + coordStr + "," +
region.coverage + "," + region.attributeScores(0) + "," + region.attributeScores(1) + "," +
region.attributeScores(2) + "," + region.attributeScores(3) + "," + region.significanceScores(0) + "," +
region.significanceScores(1) + "," + region.significanceScores(2) + "," + region.significanceScores(3) + "," +
region.avgImageCaptureDate.map(_.toString).getOrElse("NA") + "," +
region.avgLabelDate.map(_.toString).getOrElse("NA"))
} else {
writer.println(region.name + "," + region.regionID + "," + "NA" + "," + coordStr + "," + 0.0 + "," + "NA" +
writer.println("\"" + region.name + "\"," + region.regionID + "," + "NA" + "," + coordStr + "," + 0.0 + "," + "NA" +
"," + "NA" + "," + "NA" + "," + "NA" + "," + region.significanceScores(0) + "," +
region.significanceScores(1) + "," + region.significanceScores(2) + "," + region.significanceScores(3) + "," +
"NA" + "," + "NA")
Expand Down
6 changes: 3 additions & 3 deletions app/models/attribute/GlobalAttributeTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ case class GlobalAttributeForAPI(val globalAttributeId: Int,
)
)
}
val attributesToArray = Array(globalAttributeId, labelType, streetEdgeId, osmStreetId, neighborhoodName, lat.toString,
lng.toString, avgImageCaptureDate, avgLabelDate.toString,
val attributesToArray = Array(globalAttributeId, labelType, streetEdgeId, osmStreetId, "\"" + neighborhoodName + "\"",
lat.toString, lng.toString, avgImageCaptureDate, avgLabelDate.toString,
severity.getOrElse("NA").toString, temporary.toString, agreeCount.toString,
disagreeCount.toString, notsureCount.toString, labelCount.toString,
"\"[" + usersList.mkString(",") + "]\"")
Expand Down Expand Up @@ -134,7 +134,7 @@ case class GlobalAttributeWithLabelForAPI(val globalAttributeId: Int,
}
val attributesToArray = Array(globalAttributeId.toString, labelType, attributeSeverity.getOrElse("NA").toString,
attributeTemporary.toString, streetEdgeId.toString, osmStreetId.toString,
neighborhoodName, labelId.toString, gsvPanoramaId, attributeLatLng._1.toString,
"\"" + neighborhoodName + "\"", labelId.toString, gsvPanoramaId, attributeLatLng._1.toString,
attributeLatLng._2.toString, labelLatLng._1.toString, labelLatLng._2.toString,
headingPitchZoom._1.toString, headingPitchZoom._2.toString, headingPitchZoom._3.toString,
canvasXY._1.toString, canvasXY._2.toString, LabelPointTable.canvasWidth.toString,
Expand Down

0 comments on commit 08dcc06

Please sign in to comment.