Fix settings controller spec and tracks popup

This commit is contained in:
Eugene Burmakin 2025-07-20 17:06:45 +02:00
parent 5ad660ccd4
commit 002b3bd635
3 changed files with 32 additions and 44 deletions

View file

@ -5,7 +5,7 @@ class Api::V1::SettingsController < ApiController
def index
render json: {
settings: current_api_user.settings,
settings: current_api_user.safe_settings,
status: 'success'
}, status: :ok
end

View file

@ -30,7 +30,7 @@ export function createTrackPopupContent(track, distanceUnit) {
<strong>🕐 Start:</strong> ${startTime}<br>
<strong>🏁 End:</strong> ${endTime}<br>
<strong> Duration:</strong> ${durationFormatted}<br>
<strong>📏 Distance:</strong> ${formatDistance(track.distance, distanceUnit)}<br>
<strong>📏 Distance:</strong> ${formatDistance(track.distance / 1000, distanceUnit)}<br>
<strong> Avg Speed:</strong> ${formatSpeed(track.avg_speed, distanceUnit)}<br>
<strong> Elevation:</strong> +${track.elevation_gain || 0}m / -${track.elevation_loss || 0}m<br>
<strong>📊 Max Alt:</strong> ${track.elevation_max || 0}m<br>

View file

@ -21,8 +21,8 @@ describe 'Settings API', type: :request do
'immich_api_key': 'your-immich-api-key',
'photoprism_url': 'https://photoprism.example.com',
'photoprism_api_key': 'your-photoprism-api-key',
'maps': { 'distance_unit': 'km' },
'visits_suggestions_enabled': true
'speed_color_scale': 'viridis',
'fog_of_war_threshold': 100
}
}
tags 'Settings'
@ -100,21 +100,15 @@ describe 'Settings API', type: :request do
example: 'your-photoprism-api-key',
description: 'API key for PhotoPrism photo service'
},
maps: {
type: :object,
properties: {
distance_unit: {
type: :string,
example: 'km',
description: 'Distance unit preference (km or miles)'
}
},
description: 'Map-related settings'
speed_color_scale: {
type: :string,
example: 'viridis',
description: 'Color scale for speed-colored routes'
},
visits_suggestions_enabled: {
type: :boolean,
example: true,
description: 'Whether visit suggestions are enabled'
fog_of_war_threshold: {
type: :number,
example: 100,
description: 'Fog of war threshold value'
}
}
}
@ -138,33 +132,33 @@ describe 'Settings API', type: :request do
type: :object,
properties: {
route_opacity: {
type: :string,
example: '60',
type: :number,
example: 60,
description: 'Route opacity percentage (0-100)'
},
meters_between_routes: {
type: :string,
example: '500',
type: :number,
example: 500,
description: 'Minimum distance between routes in meters'
},
minutes_between_routes: {
type: :string,
example: '30',
type: :number,
example: 30,
description: 'Minimum time between routes in minutes'
},
fog_of_war_meters: {
type: :string,
example: '50',
type: :number,
example: 50,
description: 'Fog of war radius in meters'
},
time_threshold_minutes: {
type: :string,
example: '30',
type: :number,
example: 30,
description: 'Time threshold for grouping points in minutes'
},
merge_threshold_minutes: {
type: :string,
example: '15',
type: :number,
example: 15,
description: 'Threshold for merging nearby points in minutes'
},
preferred_map_layer: {
@ -207,21 +201,15 @@ describe 'Settings API', type: :request do
example: 'your-photoprism-api-key',
description: 'API key for PhotoPrism photo service'
},
maps: {
type: :object,
properties: {
distance_unit: {
type: :string,
example: 'km',
description: 'Distance unit preference (km or miles)'
}
},
description: 'Map-related settings'
speed_color_scale: {
type: :string,
example: 'viridis',
description: 'Color scale for speed-colored routes'
},
visits_suggestions_enabled: {
type: :boolean,
example: true,
description: 'Whether visit suggestions are enabled'
fog_of_war_threshold: {
type: :number,
example: 100,
description: 'Fog of war threshold value'
}
}
}