-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix
ZeroDivisionError
in TaskModel admin
e.g.: ``` File ".../site-packages/huey_monitor/models.py", line 124, in human_percentage return percentage(num=self.progress_count, total=self.total) File ".../site-packages/huey_monitor/humanize.py", line 51, in percentage frac = num / total Exception Type: ZeroDivisionError at /admin/huey_monitor/taskmodel/ Exception Value: division by zero ```
- Loading branch information
Jens Diemer
committed
Nov 20, 2023
1 parent
4a2de58
commit bc5d62c
Showing
5 changed files
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
Django based tool for monitoring huey task queue: https://github.com/coleifer/huey | ||
""" | ||
|
||
__version__ = '0.8.0' | ||
__version__ = '0.8.1' | ||
__author__ = 'Jens Diemer <[email protected]>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.test import TestCase | ||
from model_bakery import baker | ||
|
||
from huey_monitor.models import TaskModel | ||
|
||
|
||
class HueyMonitorModelsTestCase(TestCase): | ||
def test_human_percentage(self): | ||
instance = baker.make(TaskModel, progress_count=10, total=None) | ||
self.assertIs(instance.human_percentage(), None) | ||
instance.total = 100 | ||
self.assertEqual(instance.human_percentage(), '10%') |