Skip to content

Commit

Permalink
fix: progress no longer depends on tj
Browse files Browse the repository at this point in the history
  • Loading branch information
Apfelholz committed Nov 8, 2024
1 parent df2cb87 commit a87bb0c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ptop.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def parse(input_line: str) -> dict:
return parsed


def progress(lines, total_jops):
return (len(lines) / tj) * 100 if tj else 0
def progress(lines, total_jobs):
return (len(lines) / total_jobs) * 100 if total_jobs else 0


def ascii_progress_bar(percentage, bar_length=50):
Expand All @@ -60,7 +60,8 @@ def ascii_progress_bar(percentage, bar_length=50):
lines.extend(new_lines)

clear_console()
print(ascii_progress_bar(progress(lines, tj)))
if tj > 0:
print(ascii_progress_bar(progress(lines, tj)))
print(
"--------------------------------------------------------------"
)
Expand Down

0 comments on commit a87bb0c

Please sign in to comment.