@@ -123,7 +123,7 @@ def run(results: CommandResults, cmdenv: CommandEnv, tdb: TradeORM | None) -> Co
123123
124124 query = (
125125 select (candidate , distance_sq )
126- .where (distance_sq < range_sq )
126+ .where (distance_sq <= range_sq )
127127 .order_by (distance_sq )
128128 )
129129
@@ -135,8 +135,8 @@ def run(results: CommandResults, cmdenv: CommandEnv, tdb: TradeORM | None) -> Co
135135 station_filters .append (Station .market == 'Y' )
136136 if cmdenv .blackMarket :
137137 station_filters .append (Station .blackmarket == 'Y' )
138- if cmdenv .mxLs :
139- station_filters .append (Station .ls_from_star <= cmdenv .lsFromStar )
138+ if cmdenv .maxLs :
139+ station_filters .append (and_ ( Station .ls_from_star > 0 , Station . ls_from_star <= cmdenv .maxLs ) )
140140 if cmdenv .outfitting :
141141 station_filters .append (Station .outfitting == 'Y' )
142142
@@ -229,9 +229,6 @@ def render(results, cmdenv, tdb):
229229 ).append (
230230 ColumnFormat ("StnLs" , '>' , maxLsLen , "n" ,
231231 key = lambda stn : int (stn .ls_from_star or 0 ))
232- ).append (
233- ColumnFormat ("Age/days" , '>' , 7 ,
234- key = lambda stn : (round ((now - stn .modified ).total_seconds () / 86400 , 2 )) if stn .modified else "n/a" )
235232 ).append (
236233 ColumnFormat ("Mkt" , '>' , '3' ,
237234 key = lambda stn : TRISTATE_LABELS [stn .market ])
@@ -267,6 +264,10 @@ def render(results, cmdenv, tdb):
267264 key = lambda stn : TRISTATE_LABELS [stn .odyssey ])
268265 )
269266 if cmdenv .detail > 1 :
267+ stnRowFmt = stnRowFmt .append (
268+ ColumnFormat ("Age/days" , '>' , 7 ,
269+ key = lambda stn : (round ((now - stn .modified ).total_seconds () / 86400 , 2 )) if stn .modified else "n/a" )
270+ )
270271 stnRowFmt .append (
271272 ColumnFormat ("Itms" , ">" , 4 ,
272273 key = lambda stn : len (stn .items ))
@@ -287,12 +288,13 @@ def render(results, cmdenv, tdb):
287288
288289 for row in results .rows :
289290 cmdenv .uprint (sysRowFmt .format (row ))
290- stations = row .system .stations if results .summary .show_stations else []
291- truncated = False
292- if results .summary .limit :
291+ if not results .summary .show_stations :
292+ continue
293+ stations = row .system .stations
294+ truncate = results .summary .limit > 0 and len (stations ) > results .summary .limit
295+ if truncate :
293296 stations = stations [:results .summary .limit ]
294- truncated = True
295297 for stnRow in stations :
296298 cmdenv .uprint (stnRowFmt .format (stnRow ))
297- if truncated :
299+ if truncate :
298300 cmdenv .uprint (f" / ... { len (row .system .stations ) - results .summary .limit } more ..." )
0 commit comments