X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_offers;h=779d80407dc767857e2a74fd389e07432a6b0f96;hp=47c3555700c4ba290100dedddcdc0ded18311b2e;hb=59393edc418d7062f6fb074a90d3b8e810c43772;hpb=db998ff5d636967de9de9218ff0b940a4feb9a6d diff --git a/yarrg/web/query_offers b/yarrg/web/query_offers index 47c3555..779d804 100644 --- a/yarrg/web/query_offers +++ b/yarrg/web/query_offers @@ -54,6 +54,7 @@ my ($commodname,$cmid); my $qa= \%ARGS; %perl> +
-NOT YET IMPLEMENTED - +bs= <% $qa->{BuySell} %> cmdid= <% $cmid %> islandids= <% join ',', map { defined($_) ? $_ : 'U' } @islandids %>+<%perl> +} + +my $locdesc; +if (@islandids>1) { + $locdesc= ' at specified locations'; +} elsif (defined $islandids[0]) { + my $sth= $dbh->prepare("SELECT islandname FROM islands + WHERE islandid == ?"); + $sth->execute($islandids[0]); + $locdesc= ' at '.($sth->fetchrow_array())[0]; +} else { + $locdesc= ' in '.$archipelagoes[0]; +} + +my $now= time; + +my @conds; +my @condvals; +push @condvals, $cmid; +foreach my $ix (0..$#islandids) { + my $iid= $islandids[$ix]; + my $arch= $archipelagoes[$ix]; + if (defined $iid) { + push @conds, 'offers.islandid == ?'; + push @condvals, $iid; + } else { + push @conds, 'islands.archipelago == ?'; + push @condvals, $arch; + } +} +foreach my $bs (split /_/, $qa->{BuySell}) { + my %da_ages; + my %ts_sortkeys; + + die unless grep { $bs eq $_ } qw(buy sell); + my $ascdesc= $bs eq 'buy' ? 'DESC' : 'ASC'; +%perl> +
+<% $stmt %> +<% join ',', @condvals |h %> ++<%perl> + } + + my $row; + my $sth= $dbh->prepare($stmt); + $sth->execute(@condvals); + my $rowix= 0; +%perl> +% while ($row= $sth->fetchrow_arrayref) { +% if (!$rowix) { +
Archipelago + | Island + | Stall or Shoppe + | Price + | Quantity + | Data age + |
---|---|---|---|---|---|
= 3 ? 'align=right' : '' %> ><% $val |h %> +% } + | <% prettyprint_age($age) %> + |
+(Please don't use these pages to scrape data out of the YARRG +database. This will be a pain for you to program, slow to run, and +pointlessly overload our server. Instead, see our +information for developers +to find out how to get testing data or a real-time feed.) + +