Fixed crash trying to report on a system with reports disabled.
authorCMDR furrycat <elite@furrycat.net>
Wed, 11 Oct 2017 10:44:46 +0000 (11:44 +0100)
committerCMDR furrycat <elite@furrycat.net>
Wed, 11 Oct 2017 10:44:46 +0000 (11:44 +0100)
plugin/faction/faction.py

index ec51060..0f85e13 100644 (file)
@@ -601,6 +601,9 @@ class Faction(DBConnection):
     await self.report_stale_faction_influence(channel, id = tracked.faction_id)
 
   async def report_tracked_system(self, tracked):
+    if tracked.channel_id is None:
+      return
+
     update = {}
     update['updated'] = self.now()
 
@@ -671,10 +674,10 @@ class Faction(DBConnection):
     system_names = [row['system_name'] for row in cursor.fetchall()]
     self.close_db()
     if len(system_names):
-      result = await self.graph_faction_history(channel, systems = system_names, start_date = then)
-      if not result:
-        log.warning('Failed summary graph for faction {}'.format(tracked.id))
-        return
+      for name in system_names:
+        result = await self.graph_faction_history(channel, systems = [name], start_date = then)
+        if not result:
+          log.warning('Failed summary graph for faction {}'.format(tracked.id))
     else:
       log.info('No systems updated since {} for faction {}'.format(bot.iso8601(then), tracked.name))
     if what == 'faction':