fixed 'fetched in X seconds seconds'
All checks were successful
Run Integration Tests / test (push) Successful in 26s

This commit is contained in:
partisan 2025-04-24 16:56:41 +02:00
parent 06f8604779
commit 6445be87a9
9 changed files with 38 additions and 18 deletions

15
map.go
View file

@ -5,7 +5,6 @@ import (
"fmt"
"net/http"
"net/url"
"time"
)
type NominatimResponse struct {
@ -59,7 +58,7 @@ func geocodeQuery(query string) (latitude, longitude string, found bool, err err
func handleMapSearch(w http.ResponseWriter, settings UserSettings, query string) {
// Start measuring the time for geocoding the query
startTime := time.Now()
//startTime := time.Now()
// Geocode the query to get coordinates
latitude, longitude, found, err := geocodeQuery(query)
@ -70,15 +69,15 @@ func handleMapSearch(w http.ResponseWriter, settings UserSettings, query string)
}
// Measure the elapsed time for geocoding
elapsedTime := time.Since(startTime)
//elapsed := time.Since(startTime)
// Prepare the data to pass to the template
data := map[string]interface{}{
"Query": query,
"Latitude": latitude,
"Longitude": longitude,
"Found": found,
"Fetched": fmt.Sprintf("%.2f %s", elapsedTime.Seconds(), Translate("seconds")),
"Query": query,
"Latitude": latitude,
"Longitude": longitude,
"Found": found,
//"Fetched": FormatElapsedTime(elapsed), // not used in map tab
"Theme": settings.Theme,
"Safe": settings.SafeSearch,
"IsThemeDark": settings.IsThemeDark,