changeset 46:30bbda81f13b

Quick statatistic adding and some small text changes.
author df
date Mon, 26 Jan 2009 21:27:52 +0000
parents bb8e080b25da
children 9c55ad1214ee
files reproctool.cgi
diffstat 1 files changed, 56 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/reproctool.cgi	Sun Jan 25 22:34:22 2009 +0000
+++ b/reproctool.cgi	Mon Jan 26 21:27:52 2009 +0000
@@ -224,6 +224,11 @@
 END
 my $pre_reprocess = $db->prepare($sql_reprocess);
 
+# Global statistical vars
+my ($totalTrit, $totalPyer, $totalMexa, $totalIsog, $totalNocx, $totalZydr,
+    $totalMega, $totalMorp, $totalIsk, $meta0, $meta1, $meta2, $meta3, $meta4,
+    $meta5, $meta6Plus );
+
 # Execute, bring back one row per item
 my ($tid, $tname, $gname, $meta, $basePrice, $icon,
     $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp);
@@ -243,6 +248,11 @@
               ($mega * $tmega) + ($morp * $tmorp);
     my $repDetails = sprintf( "Trit=%d Py=%d Mex=%d Iso=%d Nocx=%d Zyd=%d Mega=%d Morp=%d",
                               $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp );
+
+    # End statistics.
+    $totalTrit += $ttrit; $totalPyer += $tpyer; $totalMexa += $tmexa;
+    $totalIsog += $tisog; $totalNocx += $tnocx; $totalZydr += $tzydr;
+    $totalMega += $tmega; $totalMorp += $tmorp; $totalIsk  += $isk;
     
     $meta = 0 unless defined $meta;
     $item = { id => $tid, name => $tname, meta => $meta, icon => $icon,
@@ -270,8 +280,7 @@
 </head>
 
 <body>
-Welcome to the sell, reprocess or keep tool. :)
-<p />
+<h1>Results</h1>
 Here is how it works, the colour coding:
 <ul>
     <li>Items in <font color='#666600'>dark yellow</font> are meta 0.</li>
@@ -299,6 +308,7 @@
 <a href="http://rammsrdi.com">Ramm's RDI</a>.
 <p />
 <hr>
+<p />
 <table>
 END
 
@@ -338,13 +348,13 @@
         
         switch ($item->{meta})
         {
-            case 0      { $colour = "#666600"; }
-            case 1      { $colour = "#777777"; }
-            case 2      { $colour = "#BBBBBB"; }
-            case 3      { $colour = "#FFFFFF"; }
-            case 4      { $colour = "#4444FF"; }
-            case 5      { $colour = "#FF0000"; }
-            case [6..30]{ $colour = "#00FF00"; }
+            case 0      { $colour = "#666600"; $meta0 += 1; }
+            case 1      { $colour = "#777777"; $meta1 += 1; }
+            case 2      { $colour = "#BBBBBB"; $meta2 += 1; }
+            case 3      { $colour = "#FFFFFF"; $meta3 += 1; }
+            case 4      { $colour = "#4444FF"; $meta4 += 1; }
+            case 5      { $colour = "#FF0000"; $meta5 += 1; }
+            case [6..30]{ $colour = "#00FF00"; $meta6Plus += 1; }
         }
         
         if ($item->{meta} >= 4)
@@ -381,6 +391,43 @@
 print<<END;
 </tr>
 </table>
+<hr>
+<p />
+<h1>Totals</h1>
+END
+# TODO: df wonders if there is a std::map :)
+print "Total ISK baseprice: " . pretty_numbers( $totalIsk ) . "<p />\n";
+print "<br />Trit: " . pretty_numbers( $totalTrit ) if ($totalTrit>0);
+print "<br />Py: " . pretty_numbers( $totalPyer ) if ($totalPyer>0);
+print "<br />Mex: " . pretty_numbers( $totalMexa ) if ($totalMexa>0);
+print "<br />Iso: " . pretty_numbers( $totalIsog ) if ($totalIsog>0);
+print "<br />Nox: " . pretty_numbers( $totalNocx ) if ($totalNocx>0);
+print "<br />Zyd: " . pretty_numbers( $totalZydr ) if ($totalZydr>0);
+print "<br />Mega: " . pretty_numbers( $totalMega ) if ($totalMega>0);
+print "<br />Morp: " . pretty_numbers( $totalMorp ) if ($totalMorp>0);
+print "<br />\n";
+print "<br /><font color='#666600'>Meta 0: " . pretty_numbers( $meta0 ) . "</font>" if ($meta0>0);
+print "<br /><font color='#777777'>Meta 1: " . pretty_numbers( $meta1 ) . "</font>" if ($meta1>0);
+print "<br /><font color='#BBBBBB'>Meta 2: " . pretty_numbers( $meta2 ) . "</font>" if ($meta2>0);
+print "<br /><font color='#FFFFFF'>Meta 3: " . pretty_numbers( $meta3 ) . "</font>" if ($meta3>0);
+print "<br /><font color='#4444FF'>Meta 4: " . pretty_numbers( $meta4 ) . "</font>" if ($meta4>0);
+print "<br /><font color='#FF0000'>Meta 5: " . pretty_numbers( $meta5 ) . " (T2)</font>" if ($meta5>0);
+print "<br /><font color='#00FF00'>Meta 6+: " . pretty_numbers( $meta6Plus ) . "</font>" if ($meta6Plus>0);
+
+print<<END;
+<hr>
+<p />
+<h1>Credits</h1>
+By an idea of <a href="showinfo:1383//1374652644">hfo ohforf</a>, coded by 
+<a href="showinfo:1384//689057791">hfo Omnix</a>. From 
+<a href="showinfo:2//1176688893">Ramm's RDI</a>.<br />
+How about you donate 0.1% of your total (which got calucalted at 
+END
+# TODO: Weird things happen when you use the pretty numbers function here :( (replace int)
+print int( $totalIsk /1000 );
+print<<END
+ ISK) to <a href="showinfo:1386//532549592">hfo</a> which will distribute it towards the
+creators and corperation of this tool that you are using now :). Thanks!
 </body>
 </html>
 END