Skip to content

Commit

Permalink
Program details (#115)
Browse files Browse the repository at this point in the history
* fix : program_description_print function updated

* fix : unit added to PROGRAM_DESCRIPTION

* fix : tests updated

* doc : CHANGELOG.md updated
  • Loading branch information
sepandhaghighi authored Dec 28, 2024
1 parent 5249a75 commit 7fdbbb8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions nafas/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions nafas/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@
<BLANKLINE>
Number of Cycles : 35
<BLANKLINE>
Unit : 3 seconds
<BLANKLINE>
Total Time : 07 minutes, 03 seconds
<BLANKLINE>
Sequence : Inhale, Exhale
Sequence : Inhale(1), Retain(0), Exhale(3), Sustain(0)
<BLANKLINE>
######################################################################
>>> run({'cycle': 2, 'pre': 3, 'unit': 1, 'ratio': [1, 0, 3, 0]})
Expand Down

0 comments on commit 7fdbbb8

Please sign in to comment.