chiark / gitweb /
Better output when no offers for a commodity
[ypp-sc-tools.web-live.git] / yarrg / web / query_commod
index c87b4400fdf9c8b690a274f9f5ce3242e53f9c32..b37fa39001e25ec966f234e4ff84735c340c18b7 100644 (file)
@@ -127,7 +127,12 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 </%perl>
 
 <h2>Offers to <% uc $bs |h %> <% $commodname |h %></h2>
-
+%      $islands->execute($cmid);
+%      my $island;
+%      my %ts_sortkeys;
+%      my $rowix= 0;
+%      while ($island= $islands->fetchrow_hashref) {
+%              if (!$rowix) {
 <table id="<% $bs %>_table">
 <tr>
 <th colspan=3>
@@ -143,11 +148,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 <th>+/-10%
 <th>Any
 </tr>
-%      $islands->execute($cmid);
-%      my $island;
-%      my %ts_sortkeys;
-%      my $rowix= 0;
-%      while ($island= $islands->fetchrow_hashref) {
+%              }
 %              my $islandid= $island->{'islandid'};
 %              $offers->execute($cmid, $islandid);
 %              my ($offer, $bestprice, $marginal, @beststalls);
@@ -204,6 +205,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %              }
 %              $rowix++;
 %      }
+%      if ($rowix) {
 </table>
 
 <&| tabsort,   table => "${bs}_table", sortkeys => "${bs}_sortkeys",
@@ -222,6 +224,9 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
     return price;
   }
 </&tabsort>
+%      } else {
+No offers.
+%      }
 
 <%perl>
 }