X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=59a856631b5a1cfdc042664a3d7c67815453c61f;hb=a0835ba69f333931705bf31f39b82339e7c5b16a;hp=08bad334569ea32178ec8e6e7d3345bf4d8060e5;hpb=e48954272cc534a0e90a95ecfa68feb36bcd542b;p=ypp-sc-tools.db-live.git diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 08bad33..59a8566 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -644,8 +644,8 @@ Generated by YARRG at <% % if (!$i) { Start at <% $islandname |h %> -[?] - +[what are these codes?] + % } else { % my $this_dist= $distance->($islandids[$i-1],$islandids[$i]); % $total_dist += $this_dist; @@ -693,25 +693,31 @@ Generated by YARRG at <% } unless $$todo; $$todo->{'commodname'}= $f->{'commodname'}; $$todo->{'posinclass'}= ''; - if ($f->{'posinclass'}) { - my $findclass= $dbh->prepare(<{'posinclass'}; + + my $findclass= $dbh->prepare(<execute($f->{'commodclassid'}); - my $classinfo= $findclass->fetchrow_hashref(); - if ($classinfo->{'maxposinclass'} >= 8) { + $findclass->execute($f->{'commodclassid'}); + my $classinfo= $findclass->fetchrow_hashref(); + if ($classinfo) { + my $clname= $classinfo->{'commodclass'}; + my $desc= encode_entities(sprintf "%s is under %s", + $f->{'commodname'}, $clname); + my $abbrev= substr($clname,0,1); + if ($incl) { my $maxpic= $classinfo->{'maxposinclass'}; - my $inpic= $f->{'posinclass'}; - my @tmbs= qw(TT T M B BB); - my $tmbi= ($inpic+0.5)*$#tmbs/$maxpic; - my $desc= (sprintf "%s is under %s,". - " commodity %d of %d", - $f->{'commodname'}, - $classinfo->{'commodclass'}, - $inpic, $maxpic); - $$todo->{'posinclass'}= - "
$tmbs[$tmbi]
"; + $desc.= (sprintf ", commodity %d of %d", + $incl, $maxpic); + if ($classinfo->{'maxposinclass'} >= 8) { + my @tmbs= qw(0 1 2 3 4 5 6 7 8 9); + my $tmbi= ($incl+0.5)*$#tmbs/$maxpic; + $abbrev.= " ".$tmbs[$tmbi]." "; + } } + $$todo->{'posinclass'}= + "
" + .$abbrev."
"; } $$todo->{'stallname'}= $stallname; $$todo->{Price}= $price;