mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Fix settings controller spec and tracks popup
This commit is contained in:
parent
5ad660ccd4
commit
002b3bd635
3 changed files with 32 additions and 44 deletions
|
|
@ -5,7 +5,7 @@ class Api::V1::SettingsController < ApiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render json: {
|
render json: {
|
||||||
settings: current_api_user.settings,
|
settings: current_api_user.safe_settings,
|
||||||
status: 'success'
|
status: 'success'
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export function createTrackPopupContent(track, distanceUnit) {
|
||||||
<strong>🕐 Start:</strong> ${startTime}<br>
|
<strong>🕐 Start:</strong> ${startTime}<br>
|
||||||
<strong>🏁 End:</strong> ${endTime}<br>
|
<strong>🏁 End:</strong> ${endTime}<br>
|
||||||
<strong>⏱️ Duration:</strong> ${durationFormatted}<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>⚡ Avg Speed:</strong> ${formatSpeed(track.avg_speed, distanceUnit)}<br>
|
||||||
<strong>⛰️ Elevation:</strong> +${track.elevation_gain || 0}m / -${track.elevation_loss || 0}m<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>
|
<strong>📊 Max Alt:</strong> ${track.elevation_max || 0}m<br>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ describe 'Settings API', type: :request do
|
||||||
'immich_api_key': 'your-immich-api-key',
|
'immich_api_key': 'your-immich-api-key',
|
||||||
'photoprism_url': 'https://photoprism.example.com',
|
'photoprism_url': 'https://photoprism.example.com',
|
||||||
'photoprism_api_key': 'your-photoprism-api-key',
|
'photoprism_api_key': 'your-photoprism-api-key',
|
||||||
'maps': { 'distance_unit': 'km' },
|
'speed_color_scale': 'viridis',
|
||||||
'visits_suggestions_enabled': true
|
'fog_of_war_threshold': 100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tags 'Settings'
|
tags 'Settings'
|
||||||
|
|
@ -100,21 +100,15 @@ describe 'Settings API', type: :request do
|
||||||
example: 'your-photoprism-api-key',
|
example: 'your-photoprism-api-key',
|
||||||
description: 'API key for PhotoPrism photo service'
|
description: 'API key for PhotoPrism photo service'
|
||||||
},
|
},
|
||||||
maps: {
|
speed_color_scale: {
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
distance_unit: {
|
|
||||||
type: :string,
|
type: :string,
|
||||||
example: 'km',
|
example: 'viridis',
|
||||||
description: 'Distance unit preference (km or miles)'
|
description: 'Color scale for speed-colored routes'
|
||||||
}
|
|
||||||
},
|
},
|
||||||
description: 'Map-related settings'
|
fog_of_war_threshold: {
|
||||||
},
|
type: :number,
|
||||||
visits_suggestions_enabled: {
|
example: 100,
|
||||||
type: :boolean,
|
description: 'Fog of war threshold value'
|
||||||
example: true,
|
|
||||||
description: 'Whether visit suggestions are enabled'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -138,33 +132,33 @@ describe 'Settings API', type: :request do
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: {
|
properties: {
|
||||||
route_opacity: {
|
route_opacity: {
|
||||||
type: :string,
|
type: :number,
|
||||||
example: '60',
|
example: 60,
|
||||||
description: 'Route opacity percentage (0-100)'
|
description: 'Route opacity percentage (0-100)'
|
||||||
},
|
},
|
||||||
meters_between_routes: {
|
meters_between_routes: {
|
||||||
type: :string,
|
type: :number,
|
||||||
example: '500',
|
example: 500,
|
||||||
description: 'Minimum distance between routes in meters'
|
description: 'Minimum distance between routes in meters'
|
||||||
},
|
},
|
||||||
minutes_between_routes: {
|
minutes_between_routes: {
|
||||||
type: :string,
|
type: :number,
|
||||||
example: '30',
|
example: 30,
|
||||||
description: 'Minimum time between routes in minutes'
|
description: 'Minimum time between routes in minutes'
|
||||||
},
|
},
|
||||||
fog_of_war_meters: {
|
fog_of_war_meters: {
|
||||||
type: :string,
|
type: :number,
|
||||||
example: '50',
|
example: 50,
|
||||||
description: 'Fog of war radius in meters'
|
description: 'Fog of war radius in meters'
|
||||||
},
|
},
|
||||||
time_threshold_minutes: {
|
time_threshold_minutes: {
|
||||||
type: :string,
|
type: :number,
|
||||||
example: '30',
|
example: 30,
|
||||||
description: 'Time threshold for grouping points in minutes'
|
description: 'Time threshold for grouping points in minutes'
|
||||||
},
|
},
|
||||||
merge_threshold_minutes: {
|
merge_threshold_minutes: {
|
||||||
type: :string,
|
type: :number,
|
||||||
example: '15',
|
example: 15,
|
||||||
description: 'Threshold for merging nearby points in minutes'
|
description: 'Threshold for merging nearby points in minutes'
|
||||||
},
|
},
|
||||||
preferred_map_layer: {
|
preferred_map_layer: {
|
||||||
|
|
@ -207,21 +201,15 @@ describe 'Settings API', type: :request do
|
||||||
example: 'your-photoprism-api-key',
|
example: 'your-photoprism-api-key',
|
||||||
description: 'API key for PhotoPrism photo service'
|
description: 'API key for PhotoPrism photo service'
|
||||||
},
|
},
|
||||||
maps: {
|
speed_color_scale: {
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
distance_unit: {
|
|
||||||
type: :string,
|
type: :string,
|
||||||
example: 'km',
|
example: 'viridis',
|
||||||
description: 'Distance unit preference (km or miles)'
|
description: 'Color scale for speed-colored routes'
|
||||||
}
|
|
||||||
},
|
},
|
||||||
description: 'Map-related settings'
|
fog_of_war_threshold: {
|
||||||
},
|
type: :number,
|
||||||
visits_suggestions_enabled: {
|
example: 100,
|
||||||
type: :boolean,
|
description: 'Fog of war threshold value'
|
||||||
example: true,
|
|
||||||
description: 'Whether visit suggestions are enabled'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue