chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.main.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change memlim to 20M as Algol reports it can be exceeded!
[ypp-sc-tools.main.git]
/
yarrg
/
web
/
check_lossperleague
diff --git
a/yarrg/web/check_lossperleague
b/yarrg/web/check_lossperleague
index 5994f6fdd8373831c1402499a5de0f7ddbc02fa7..3198d41df3bec1b2ca72a388e4105daed72615c2 100644
(file)
--- a/
yarrg/web/check_lossperleague
+++ b/
yarrg/web/check_lossperleague
@@
-29,37
+29,35
@@
sponsored by Three Rings.
sponsored by Three Rings.
- This Mason component simply defines how to interpret
capacities
.
+ This Mason component simply defines how to interpret
losses per league
.
</%doc>
</%doc>
-
-<%attr>
-</%attr>
-
-<%method preparse>
+<%method execute>
<%args>
<%args>
-$h
+$string
+$dbh
+$debugf
</%args>
<%perl>
</%args>
<%perl>
-$_= $
{ $h->{String} }
;
+$_= $
string
;
s/^\s+//; s/\s+$//;
s/^\s+//; s/\s+$//;
-my $res= sub {
- my ($pct,$str) = @_;
- push @{ $h->{Results} }, [ $pct ];
- ${ $h->{Canon} }= "$str per league";
-};
+my ($pct,$str);
if (!m/\S/) {
if (!m/\S/) {
+ return ('[no losses]', undef);
} elsif (m/^(\d{1,2}(?:\.\d{0,5})?)\%$/) {
} elsif (m/^(\d{1,2}(?:\.\d{0,5})?)\%$/) {
- $res->( $1 * 1.0, sprintf("%g%%", $1) );
+ $pct= $1 * 1.0;
+ $str= sprintf("%g%%", $1);
} elsif (m/^1\s*\/\s*([1-9]\d{0,4})/) {
} elsif (m/^1\s*\/\s*([1-9]\d{0,4})/) {
- $res->( 100.0/$1, sprintf("1/%d", $1) );
+ $pct= 100.0/$1;
+ $str= sprintf("1/%d", $1);
} else {
} else {
- ${ $h->{Emsg} }= "Cannot understand loss per league \`$_'.";
- return;
+ expected_error("Cannot understand loss per league ".escerrq($_).".");
}
}
+return ("$str [per league]", $pct);
+
</%perl>
</%method>
</%perl>
</%method>