chiark / gitweb /
do not say how many aboard if we are not
[ypp-sc-tools.db-test.git] / yoweb-scrape
index 08ebf8eccf131819e41bdf6f007cc7b848d2dffe..df8de47a0bce5d7b02fc750cd834fdf78dcba7ed 100755 (executable)
@@ -1030,7 +1030,9 @@ def do_ship_aid(args, bu):
 
 class KeyBasedSorter:
        def compar_key_pa(self, pa):
-               return self.compar_key(pa.pirate_info())
+               pi = pa.pirate_info()
+               if pi is None: return None
+               return self.compar_key(pi)
        def lsort_pa(self, l):
                l.sort(key = self.compar_key_pa)
 
@@ -1099,8 +1101,11 @@ def ship_aid_core(myself, track, displayer, kreader):
 
                tbl_s = StringIO()
                tbl = StandingsTable(tbl_s)
-               tbl.headings(' %d aboard' % len(aboard),
-                               '  sorted by '+sort.desc())
+
+               if track.vesselname(): howmany = ' %d aboard' % len(aboard)
+               else: howmany = ''
+
+               tbl.headings(howmany, '  sorted by '+sort.desc())
 
                for pa in aboard:
                        pi = pa.pirate_info()