fix: say why the plan's numbers differ

This commit is contained in:
Abdessamad Derraz committed 2026-10-26 21:09:53 +01:00
1 parent 7e96e12a4f
commit 381ec6de69
2 files changed
+21 -2

No files matched your search

+8 -2
View File
@@ -12044,8 +12044,14 @@ def _plan_lines(check: dict, dest: Path | None, state: TuiState) -> list:
]
if state.facts.get("writable") is False:
lines.append("You cannot write to this folder: choose another one.")
lines.append(f"{check['present']} in place, {check['missing']} missing, "
f"{wrong} wrong {'copy' if wrong == 1 else 'copies'}")
counts = (f"{check['present']} in place, {check['missing']} missing, "
f"{wrong} wrong {'copy' if wrong == 1 else 'copies'}")
if copied and fetch:
# 47 to download above 49 missing and 1 wrong copy: the 3 found on
# this machine are the difference, said where the sum is read.
counts += (f": {len(copied)} of them {'is' if len(copied) == 1 else 'are'} "
f"copied from this machine, {fetch} downloaded")
lines.append(counts)
saves = (state.saves if check is state.check
else state.dry_saves if check is state.dry else None)
lines += [_styled(line, "path") for line in _saves_lines(state, saves)]
+13
View File
@@ -3908,6 +3908,19 @@ class TheFolderScreenSaysWhatItOffers(unittest.TestCase):
self.assertEqual(rows[state.focus["folder"]].action, "browse")
class ThePlanNumbersAddUp(unittest.TestCase):
""""47 files to download" sat above "49 missing, 1 wrong copy": the 3
found on this machine were the difference, left to the reader."""
def test_the_copied_files_are_the_difference(self):
state = checked_state()
state.found = [found("scph5500.bin", str(SYSTEM_DIR), "one folder too deep")]
screen = " ".join(" ".join(install.tui_view(state, 120, 40)).split())
self.assertIn("3 files to download", screen)
self.assertIn("1 in place, 3 missing, 1 wrong copy: 1 of them is copied from this "
"machine, 3 downloaded", screen)
class NothingFoundIsSaid(unittest.TestCase):
"""With nothing detected the first screen was the list of 18 setups,
with no line at 40x15 saying nothing was found, which the beginner's