fixed edge cases that caused crashes
This commit is contained in:
parent
62b0102020
commit
1965ac4cbd
@ -18,10 +18,14 @@ class DownloadResult:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def success_percentage(self) -> float:
|
def success_percentage(self) -> float:
|
||||||
|
if self.total == 0:
|
||||||
|
return 0
|
||||||
return self.success / self.total
|
return self.success / self.total
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def failure_percentage(self) -> float:
|
def failure_percentage(self) -> float:
|
||||||
|
if self.total == 0:
|
||||||
|
return 1
|
||||||
return self.fail / self.total
|
return self.fail / self.total
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -30,6 +34,9 @@ class DownloadResult:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_mild_failure(self) -> bool:
|
def is_mild_failure(self) -> bool:
|
||||||
|
if self.is_fatal_error:
|
||||||
|
return True
|
||||||
|
|
||||||
return self.failure_percentage > SHOW_DOWNLOAD_ERRORS_THRESHOLD
|
return self.failure_percentage > SHOW_DOWNLOAD_ERRORS_THRESHOLD
|
||||||
|
|
||||||
def merge(self, other: "DownloadResult"):
|
def merge(self, other: "DownloadResult"):
|
||||||
|
Loading…
Reference in New Issue
Block a user