Unnamed imported tracks (FIT, ...) take the file's name, backfilled once for earlier imports; split and best-effort times with seconds
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-17 23:37:41 +01:00
1 parent 21c5c2f21b
commit d87b8b8f80
5 files changed
+30 -11

No files matched your search

+1
View File
@@ -167,6 +167,7 @@ class AppTest < Minitest::Test
properties = json_body(request.get(node_url(key)))["features"][0]["properties"]
assert_equal "cycling", properties["activity_type"]
assert_equal [0, 1], properties["laps"]
assert_equal "ride", properties["name"] # no name in the file: the file's
fit = request.get("#{node_url(key)}?download=fit&name=Ride", **logged_in_env)
assert_equal 200, fit.status
+3 -2
View File
@@ -181,16 +181,17 @@ class LibraryTest < Minitest::Test
library = open_library
key = library.import(folder: "", filename: "ride.gpx", io: File.open(fixture_path("sample.gpx"))).find { |k| k.start_with?("item:") }
id = key.delete_prefix("item:")
# As if imported by an older parser: no profile yet, renamed since.
# As if imported by an older parser: no profile or name yet.
db = SQLite3::Database.new(File.join(@dir, "library.sqlite"))
props = JSON.parse(db.get_first_value("SELECT properties FROM items WHERE id = ?", [id]))
db.execute("UPDATE items SET properties = ?, name = 'Mine' WHERE id = ?", [JSON.generate(props.except("profile").merge("color" => "#ff0000")), id])
db.execute("UPDATE items SET properties = ?, name = NULL WHERE id = ?", [JSON.generate(props.except("profile", "name").merge("color" => "#ff0000")), id])
db.execute("UPDATE meta SET parser = 0")
assert_equal 1, library.reparse
props = JSON.parse(db.get_first_value("SELECT properties FROM items WHERE id = ?", [id]))
assert props["profile"].any?
assert_equal "#ff0000", props["color"]
assert_equal "ride", db.get_first_value("SELECT name FROM items WHERE id = ?", [id]) # unnamed: the file's
assert_equal 0, library.reparse # done once
end
+2 -2
View File
@@ -25,7 +25,7 @@ class SearchTest < Minitest::Test
def test_finds_across_sources_ignoring_case_and_diacritics_and_says_where
layer = search("kosice")
assert_equal [["Kemp Košice", "layers", "trips / Track"]], layer.map { |r| r.values_at(:name, :source, :source_label) }
assert_equal [["Kemp Košice", "layers", "trips / camps"]], layer.map { |r| r.values_at(:name, :source, :source_label) }
assert_match(/\Aitem:/, layer.first[:ref])
trail = search("snp hrdinov").first
@@ -35,7 +35,7 @@ class SearchTest < Minitest::Test
def test_matches_description_and_falls_back_to_node_label_with_bbox
assert_equal ["Kemp Košice"], search("voda").map { |r| r[:name] }
track = search("trips track").first
track = search("camps").find { |r| r[:name] == "camps" }
assert_equal [17.0, 48.0, 18.0, 49.0], track[:bbox]
end