From 7fdbbb829d58e07ad37f43ee190f6ea4bbac7755 Mon Sep 17 00:00:00 2001 From: Sepand Haghighi Date: Sat, 28 Dec 2024 22:25:14 +0330 Subject: [PATCH] Program details (#115) * fix : program_description_print function updated * fix : unit added to PROGRAM_DESCRIPTION * fix : tests updated * doc : CHANGELOG.md updated --- CHANGELOG.md | 1 + nafas/functions.py | 5 +++-- nafas/params.py | 6 ++++-- test/test.py | 4 +++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac2538e..5d1d43e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `README.md` modified - `AUTHORS.md` updated - Exit bug fixed +- Program details updated ## [0.8] - 2024-11-04 ### Added - Balancing program diff --git a/nafas/functions.py b/nafas/functions.py index 9785853..37f9be0 100644 --- a/nafas/functions.py +++ b/nafas/functions.py @@ -165,10 +165,10 @@ def program_description_print(program_name, level, program_data): """ cycle = program_data["cycle"] ratio = program_data["ratio"] + unit = program_data["unit"] sequence = [] for index, item in enumerate(ratio): - if item != 0: - sequence.append(STEP_MAP[index]) + sequence.append("{0}({1})".format(STEP_MAP[index], item)) sequence = ", ".join(sequence) total_time = time_calc(program_data) line() @@ -177,6 +177,7 @@ def program_description_print(program_name, level, program_data): program_name, level, str(cycle), + str(unit), time_convert(total_time), sequence)) line() diff --git a/nafas/params.py b/nafas/params.py index 2456c73..c571ad7 100644 --- a/nafas/params.py +++ b/nafas/params.py @@ -34,9 +34,11 @@ Number of Cycles : {2} -Total Time : {3} +Unit : {3} seconds -Sequence : {4} +Total Time : {4} + +Sequence : {5} """ MINUTES_TEMPLATE = "{:02.0f} minutes" diff --git a/test/test.py b/test/test.py index e5c77bf..791cd94 100644 --- a/test/test.py +++ b/test/test.py @@ -97,9 +97,11 @@ Number of Cycles : 35 +Unit : 3 seconds + Total Time : 07 minutes, 03 seconds -Sequence : Inhale, Exhale +Sequence : Inhale(1), Retain(0), Exhale(3), Sustain(0) ###################################################################### >>> run({'cycle': 2, 'pre': 3, 'unit': 1, 'ratio': [1, 0, 3, 0]})