Match up distance from reporter in UI and API

This commit is contained in:
Eli Ribble 2026-03-09 22:18:24 +00:00
parent 642309520f
commit f6ce5f91a2
No known key found for this signature in database
3 changed files with 4 additions and 4 deletions

View file

@ -883,7 +883,7 @@
>Distance from Reporter</small
>
<span
x-text="selectedCommunication.public_report.images[currentPhotoIndex].exif?.distance_from_reporter_meters || 'N/A'"
x-text="selectedCommunication.public_report.images[currentPhotoIndex].distance_from_reporter_meters || 'N/A'"
></span>
</div>
</div>

View file

@ -35,7 +35,7 @@ func loadImagesForReportNuisance(ctx context.Context, org_id int32, report_ids [
"i.storage_uuid AS uuid",
"COALESCE(ST_X(i.location), 0) AS \"location.longitude\"",
"COALESCE(ST_Y(i.location), 0) AS \"location.latitude\"",
"ST_Distance(i.location::geography, n.location::geography) AS \"distance_to_reporter_meters\"",
"ST_Distance(i.location::geography, n.location::geography) AS \"distance_from_reporter_meters\"",
"COALESCE(MAX(e.value) FILTER (WHERE e.name = 'Make'), '') AS exif_make",
"COALESCE(MAX(e.value) FILTER (WHERE e.name = 'Model'), '') AS exif_model",
"COALESCE(MAX(e.value) FILTER (WHERE e.name = 'DateTime'), '') AS exif_datetime",

View file

@ -35,7 +35,7 @@ func (e Exif) MarshalJSON() ([]byte, error) {
}
type Image struct {
DistanceToReporterMeters float64 `db:"distance_to_reporter_meters"`
DistanceToReporterMeters float64 `db:"distance_from_reporter_meters"`
Exif Exif `db:"-" json:"exif"`
ExifMake string `db:"exif_make" json:"-"`
ExifModel string `db:"exif_model" json:"-"`
@ -48,7 +48,7 @@ type Image struct {
func (i *Image) MarshalJSON() ([]byte, error) {
to_marshal := make(map[string]interface{}, 0)
to_marshal["distance_to_reporter_meters"] = i.DistanceToReporterMeters
to_marshal["distance_from_reporter_meters"] = i.DistanceToReporterMeters
to_marshal["exif"] = Exif{
Created: i.ExifDateTime,
Make: i.ExifMake,