X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=e4e583a83a190f1f33a77411c8533fdf50b505a8;hb=2cf70baa979e0c460e4e46a9c1a53677b09a1972;hp=12b4a895f28f29e3847ab4ccbbd2c87a47b81668;hpb=6f2f4d2443ccb3ce9fb30820c27c3cd0cb67fa07;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 12b4a89..e4e583a 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -575,42 +575,44 @@ Start at <% $islandname |h %> Sail to <% $islandname |h %> % } -% my $age_reported= 0; -% my %flowlists; -% foreach my $od (qw(org dst)) { -% foreach my $f (@flows) { -% next if $f->{Suppress}; -% next unless $f->{"${od}_id"} == $islandids[$i]; -% next unless $f->{OptQty}; -% my $price= $f->{"${od}_price"}; -% my $stallname= $f->{"${od}_stallname"}; -% my $todo= \$flowlists{$od}{ -% $f->{'commodname'}, -% (sprintf "%07d", $price), -% $stallname -% }; -% $$todo= { -% Qty => 0, -% orgArbitrage => 0, -% dstArbitrage => 0, -% } unless $$todo; -% $$todo->{'commodname'}= $f->{'commodname'}; -% $$todo->{'stallname'}= $stallname; -% $$todo->{Price}= $price; -% $$todo->{Timestamp}= $f->{"${od}_timestamp"}; -% $$todo->{Qty} += $f->{OptQty}; -% $$todo->{Total}= $$todo->{Price} * $$todo->{Qty}; -% $$todo->{Stalls}= $f->{"${od}Stalls"}; -% if ($f->{'org_id'} == $f->{'dst_id'}) { -% $$todo->{"${od}Arbitrage"}= 1; -% } -% } -% } -% -% my $total; -% my $dline= 0; -% my $show_flows= sub { -% my ($od,$arbitrage,$collectdeliver) = @_; +<%perl> + my $age_reported= 0; + my %flowlists; + foreach my $od (qw(org dst)) { + foreach my $f (@flows) { + next if $f->{Suppress}; + next unless $f->{"${od}_id"} == $islandids[$i]; + next unless $f->{OptQty}; + my $price= $f->{"${od}_price"}; + my $stallname= $f->{"${od}_stallname"}; + my $todo= \$flowlists{$od}{ + $f->{'commodname'}, + (sprintf "%07d", $price), + $stallname + }; + $$todo= { + Qty => 0, + orgArbitrage => 0, + dstArbitrage => 0, + } unless $$todo; + $$todo->{'commodname'}= $f->{'commodname'}; + $$todo->{'stallname'}= $stallname; + $$todo->{Price}= $price; + $$todo->{Timestamp}= $f->{"${od}_timestamp"}; + $$todo->{Qty} += $f->{OptQty}; + $$todo->{Total}= $$todo->{Price} * $$todo->{Qty}; + $$todo->{Stalls}= $f->{"${od}Stalls"}; + if ($f->{'org_id'} == $f->{'dst_id'}) { + $$todo->{"${od}Arbitrage"}= 1; + } + } + } + + my $total; + my $dline= 0; + my $show_flows= sub { + my ($od,$arbitrage,$collectdeliver) = @_; + % % my $todo= $flowlists{$od}; % return unless $todo; @@ -663,14 +665,16 @@ Sail to <% $islandname |h %> % } % $total= undef; % $dline= 0; -% }; -% -% $show_flows->('org',1,'Collect'); $show_total->('(Arbitrage) outlay'); -% $show_flows->('dst',1,'Deliver'); -% $show_flows->('dst',0,'Deliver'); $show_total->('Proceeds'); -% $show_flows->('org',0,'Collect'); $show_total->('Outlay'); -% -% } +<%perl> + }; + + $show_flows->('org',1,'Collect'); $show_total->('(Arbitrage) outlay'); + $show_flows->('dst',1,'Deliver'); + $show_flows->('dst',0,'Deliver'); $show_total->('Proceeds'); + $show_flows->('org',0,'Collect'); $show_total->('Outlay'); + +} + <& query_age:dataages, id2age => \%da_ages &> %