X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_commod;h=34b1347f20f5034315a1821d535cd6de40f8f8e2;hp=c9b17ae6700b72a0e5ba135a14d95ff381ae3a98;hb=f6d7a4d627f3ecc0624649bb895dbf8e59afcf47;hpb=00ba9271fd8409f29fcae6ee2af15824810bc939 diff --git a/yarrg/web/query_commod b/yarrg/web/query_commod index c9b17ae..34b1347 100644 --- a/yarrg/web/query_commod +++ b/yarrg/web/query_commod @@ -89,20 +89,21 @@ $someresults->(); #---------- actually compute the results and print them ---------- +my $onloads= ""; + foreach my $bs (split /_/, $ARGS{BuySell}) { $bs =~ m/^(buy|sell)$/ or die; $bs= $1; my ($ascdesc) = ($bs eq 'buy') ? ('DESC') : ('ASC'); - my $joinkind= $ARGS{ShowBlank} eq 'show' - ? 'LEFT OUTER JOIN' : 'INNER JOIN'; + my $joinkind= $ARGS{ShowBlank} ? 'LEFT OUTER JOIN' : 'INNER JOIN'; my $islands= $dbh->prepare( "SELECT islands.islandid AS islandid, archipelago, islandname, sum(qty) as tqty FROM islands $joinkind $bs offers ON islands.islandid == offers.islandid AND commodid == ? - GROUP BY islands.islandid, + GROUP BY islands.islandid ORDER BY archipelago, islandname" ); @@ -118,23 +119,25 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
Prices - | Quantities available - | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Quantity at price + | |||||||||||
Archipelago | Island - | Unique best stall + | Stall(s) | Best | Median - | At best - | Within 10% - | Total + | Best + | +/-10% + | Any |
<% $island->{'archipelago'} |h %> - | <% $island->{'islandname'} |h %> - | <% $nstalls==0 ? '-' : - $nstalls==1 ? $beststalls[0] : "$nstalls offers" |h %> - | <% length $bestqty ? $bestprice : '-' %> - | <% $median %> - | <% $bestqty %> - | <% $approxqty %> - | <% $cqty %> + | ||||
<% $s->[0]= $island->{'archipelago'} |h %> + | <% $s->[1]= $island->{'islandname'} |h %> + | <% $stallname |h %> + | <% $s->[3]= (length $bestqty ? $bestprice : '-') %> + | <% $s->[4]= $median %> + | <% $s->[5]= $bestqty %> + | <% $s->[6]= $approxqty %> + | <% $s->[7]= $cqty %> |