Leave trails with no track out of apply, for a person to place
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1767bf4789
commit
44fbb0405b
2 files changed
+9
-2
No files matched your search
@@ -958,10 +958,11 @@ def apply(proposal_path, root, today, exclude=frozenset()):
|
|||||||
names = {(v["kind"], v["slug"]): v["name"] for v in per_place.values()}
|
names = {(v["kind"], v["slug"]): v["name"] for v in per_place.values()}
|
||||||
written = []
|
written = []
|
||||||
named = set()
|
named = set()
|
||||||
|
trackless = set(data.get("no_track") or [])
|
||||||
for tid in sorted(data.get("per_trail") or {}):
|
for tid in sorted(data.get("per_trail") or {}):
|
||||||
tdir = os.path.join(root, tid)
|
tdir = os.path.join(root, tid)
|
||||||
if not os.path.isfile(os.path.join(tdir, "trail.toml")):
|
if tid in trackless or not os.path.isfile(os.path.join(tdir, "trail.toml")):
|
||||||
continue
|
continue # a trail with no track is placed by a person (stated, stamp)
|
||||||
doc, path = _doc_of(root, tid)
|
doc, path = _doc_of(root, tid)
|
||||||
rec = doc.data()
|
rec = doc.data()
|
||||||
new_places = [p for p in data["per_trail"][tid]
|
new_places = [p for p in data["per_trail"][tid]
|
||||||
|
|||||||
@@ -421,6 +421,12 @@ class ApplyTest(unittest.TestCase):
|
|||||||
if line.strip():
|
if line.strip():
|
||||||
self.assertIn(line, after.splitlines(), line)
|
self.assertIn(line, after.splitlines(), line)
|
||||||
|
|
||||||
|
def test_apply_leaves_a_trail_with_no_track_alone_for_a_person_to_place(self):
|
||||||
|
before = open(self.trail_toml("zz"), "rb").read()
|
||||||
|
written = P.apply(self.pjson, self.root, "2026-11-20")
|
||||||
|
self.assertNotIn("zz", written)
|
||||||
|
self.assertEqual(open(self.trail_toml("zz"), "rb").read(), before)
|
||||||
|
|
||||||
def test_apply_adds_one_history_entry_naming_place_with_no_distance_in_it(self):
|
def test_apply_adds_one_history_entry_naming_place_with_no_distance_in_it(self):
|
||||||
P.apply(self.pjson, self.root, "2026-11-20")
|
P.apply(self.pjson, self.root, "2026-11-20")
|
||||||
data = read_toml(self.trail_toml("aa"))
|
data = read_toml(self.trail_toml("aa"))
|
||||||
|
|||||||
Reference in new issue
Block a user