From 4ee718187692e362a0e274020a0ad61701f1b2de Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 12 Nov 2009 18:20:16 +0000 Subject: [PATCH] New way of showing position in list info --- yarrg/web/routetrade | 28 +++++++++++++++++++++------- yarrg/web/style.css | 1 + 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 27cf295..4134020 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -695,12 +695,26 @@ SELECT commodclass, maxposinclass FROM commodclasses WHERE commodclassid = ? END $findclass->execute($f->{'commodclassid'}); my $classinfo= $findclass->fetchrow_hashref(); - $$todo->{'posinclass'}= - sprintf "(%s %d/%d)", - $classinfo->{'commodclass'}, - $f->{'posinclass'}, - $classinfo->{'maxposinclass'} - if $classinfo->{'maxposinclass'} > 9; + if ($classinfo->{'maxposinclass'} >= 8) { + my $maxpic= $classinfo->{'maxposinclass'}; + my $inpic= $f->{'posinclass'}; + my @tmbs= qw(TT T M B BB); + my @tmbds= ( 'in Top fifth of list', + 'in 2nd fifth of the list', + 'in Middle fifth of the list', + 'in 2nd-bottom fifth of list', + 'in Bottom fifth of the list'); + my $tmbi= ($inpic+0.5)*$#tmbs/$maxpic; + my $desc= (sprintf "%s is under %s,". + " commodity %d of %d;". + " i.e. %s or %s", + $f->{'commodname'}, + $classinfo->{'commodclass'}, + $inpic, $maxpic, + $tmbs[$tmbi], $tmbds[$tmbi]); + $$todo->{'posinclass'}= + "
$tmbs[$tmbi]
"; + } } $$todo->{'stallname'}= $stallname; $$todo->{Price}= $price; @@ -764,7 +778,7 @@ END % tr_datarow($m,$dline); <<% $td %>><% $collectdeliver %> <<% $td %>><% $t->{'commodname'} |h %> -<<% $td %>><% $t->{'posinclass'} |h %> +<<% $td %>><% $t->{'posinclass'} %> % % my @stalls= sort keys %{ $t->{Stalls} }; % my $pstall= sub { diff --git a/yarrg/web/style.css b/yarrg/web/style.css index 858dcb9..1d52168 100755 --- a/yarrg/web/style.css +++ b/yarrg/web/style.css @@ -47,4 +47,5 @@ $r->content_type('text/css') padding-left: 1em; padding-top: 0.15em; padding-right: 1em; padding-bottom: 0.15em; } + div.mouseover { color: blue; } hr { display: none; } -- 2.30.2