Skip to content

Commit

Permalink
feat: improve logging for species settings rendering
Browse files Browse the repository at this point in the history
- Added debug logging to output the species configuration being passed to the template for better traceability.
- Removed unnecessary threshold handling code to streamline the rendering process.
  • Loading branch information
tphakala committed Jan 9, 2025
1 parent ea40e1c commit 7187f73
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions internal/httpcontroller/template_renderers.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,15 @@ func (s *Server) renderSettingsContent(c echo.Context) (template.HTML, error) {
if templateName == "detectionfiltersSettings" ||
templateName == "speciesSettings" {
data["PreparedSpecies"] = s.prepareSpeciesData()

// For thresholds, we need to handle the map specially
var thresholdStrings []string
for species, threshold := range s.Settings.Realtime.Species.Config {
thresholdStrings = append(thresholdStrings, fmt.Sprintf("[%s: %f]", species, threshold.Threshold))
}
}

// DEBUG Log the species settings
//log.Printf("Species Settings: %+v", s.Settings.Realtime.Species)

if templateName == "speciesSettings" {
log.Printf("Debug: Species Config being passed to template: %+v", s.Settings.Realtime.Species.Config)
}

// Render the template
var buf bytes.Buffer
err := s.Echo.Renderer.Render(&buf, templateName, data, c)
Expand Down

0 comments on commit 7187f73

Please sign in to comment.