diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-22 01:29:51 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-22 01:29:51 +0100 |
| commit | e42649e393b2e2a50853a4d38dffab79af124dea (patch) | |
| tree | 5018f3627e637aa84f6e41bce53ffde3d8db19f6 /ui.py | |
| parent | 9ca37a0dc4281271dc0ac883cd1191574da05f32 (diff) | |
| download | EgoMetrics-e42649e393b2e2a50853a4d38dffab79af124dea.tar.gz EgoMetrics-e42649e393b2e2a50853a4d38dffab79af124dea.zip | |
Diffstat (limited to 'ui.py')
| -rw-r--r-- | ui.py | 48 |
1 files changed, 28 insertions, 20 deletions
@@ -127,7 +127,10 @@ def prompt_sets_detail( default_rest: int | None = None, bw_relative: bool = False, ) -> tuple[str, str, str]: - """Prompt for reps, weight (kg), and rest time on each set, return comma-separated strings.""" + """Prompt for reps, weight (kg), and rest time on each set, return comma-separated strings. + + Rest is only prompted for sets 1..sets-1 (no rest after the last set). + """ weight_label = "Weight relative to BW (kg)" if bw_relative else "Weight kg" weight_min: float | None = None if bw_relative else 0.0 reps_list = [] @@ -153,26 +156,31 @@ def prompt_sets_detail( w = prompt_float(f" {weight_label}: ", min_val=weight_min) assert w is not None weight_list.append(f"{w:.1f}") - if default_rest is not None: - rest_val = input(f" Rest seconds [{default_rest}] (- = skip): ").strip() - if rest_val == "-": - rest_list.append("") - elif rest_val == "": - rest_list.append(str(default_rest)) - else: - try: - n = int(rest_val) - if n < 0: - print(" Must be at least 0, using default.") - rest_list.append(str(default_rest)) - else: - rest_list.append(str(n)) - except ValueError: - print(" Invalid input, using default.") + if i < sets: + if default_rest is not None: + rest_val = input( + f" Rest seconds [{default_rest}] (- = skip): " + ).strip() + if rest_val == "-": + rest_list.append("") + elif rest_val == "": rest_list.append(str(default_rest)) - else: - rt = prompt_int(" Rest seconds (optional): ", required=False, min_val=0) - rest_list.append(str(rt) if rt is not None else "") + else: + try: + n = int(rest_val) + if n < 0: + print(" Must be at least 0, using default.") + rest_list.append(str(default_rest)) + else: + rest_list.append(str(n)) + except ValueError: + print(" Invalid input, using default.") + rest_list.append(str(default_rest)) + else: + rt = prompt_int( + " Rest seconds (optional): ", required=False, min_val=0 + ) + rest_list.append(str(rt) if rt is not None else "") return ",".join(reps_list), ",".join(weight_list), ",".join(rest_list) |
