Bazaar Status body<=
[<< Back]
selectrow_hashref("SELECT * FROM bzrs WHERE open='1' ". "ORDER BY datestart LIMIT 1"); return "No bazaar session is currently active." unless $bz; } else { $bz = $dbh->selectrow_hashref("SELECT * FROM bzrs WHERE bzid=?", undef, $bzid); return "Invalid bazaar ID" unless $bz; } $bzid = $bz->{'bzid'}; my (@pot, $pot); $sth = $dbh->prepare("SELECT dateadd, amt, reason FROM bzrpot ". "WHERE bzid=? ORDER BY dateadd"); $sth->execute($bzid); while ($_ = $sth->fetchrow_hashref) { push @pot, $_; $pot += $_->{'amt'}; } my $is_voter; $sth = $dbh->prepare("SELECT u.user, u.name, v.weight FROM bzrvoter v, user u ". "WHERE u.userid=v.userid AND v.bzid=? ". "ORDER BY v.weight DESC"); $sth->execute($bzid); my @voters; while ($_ = $sth->fetchrow_hashref) { push @voters, $_; $_->{'_votelink'} = 1 if $bz->{'open'} && $remote && $remote->{'user'} eq $_->{'user'}; } $ret .= "Bazaar Session: | \#$bzid: $bz->{'name'} | |||
Start Time: | $bz->{'datestart'} | |||
State: | $state | |||
Pot: | \$" . sprintf("%0.02f", $pot) . "";
if (@pot > 1) {
$ret .= " Details:
|
User | Weight | |
" . LJ::ljuser($v->{'user'}) . " - $name | " . sprintf("%0.02f%%", $v->{'weight'}*100) . " | "; $ret .= ""; if ($v->{'_votelink'}) { $ret .= "[Vote]"; } $ret .= " |
[$c->{'coid'}] "; $ret .= LJ::ljuser($c->{'user'}) . ": $des ($c->{'cat'}; $c->{'dateadd'})
\n"; } $ret .= "