fix: Update _has_news_changed to properly handle list format news data

This commit is contained in:
ChuckBuilds
2025-04-18 20:33:51 -05:00
parent 21b6a15445
commit 62e99be45b

View File

@@ -137,8 +137,11 @@ class CacheManager:
def _has_news_changed(self, cached: Dict[str, Any], new: Dict[str, Any]) -> bool: def _has_news_changed(self, cached: Dict[str, Any], new: Dict[str, Any]) -> bool:
"""Check if news data has changed.""" """Check if news data has changed."""
# Handle both dictionary and list formats # Handle both dictionary and list formats
if isinstance(cached, list) and isinstance(new, list): if isinstance(new, list):
# If both are lists, compare their lengths and content # If new data is a list, cached data should also be a list
if not isinstance(cached, list):
return True
# Compare lengths and content
if len(cached) != len(new): if len(cached) != len(new):
return True return True
# Compare titles since they're unique enough for our purposes # Compare titles since they're unique enough for our purposes