Skip to content

Commit

Permalink
Fix issue with showingf correct version after restore (#2283)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Nov 13, 2021
1 parent 6cc2685 commit b743cc6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions custom_components/hacs/helpers/properties/pending_update.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pylint: disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,no-member
from abc import ABC

from awesomeversion import AwesomeVersion, AwesomeVersionException


class RepositoryPropertyPendingUpdate(ABC):
@property
Expand All @@ -13,8 +15,17 @@ def pending_update(self) -> bool:
if self.data.installed_commit != self.data.last_commit:
return True
return False
if self.display_installed_version != self.display_available_version:
return True
if self.display_version_or_commit == "commit":
if self.display_installed_version != self.display_available_version:
return True
else:
try:
return AwesomeVersion(self.display_available_version) > AwesomeVersion(
self.display_installed_version
)
except AwesomeVersionException:
# Assume pending_update on failure
return True
return False

@property
Expand Down

0 comments on commit b743cc6

Please sign in to comment.