changeset 255:af08f54f0bc6 misc

Upstream sync.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 08 Mar 2015 02:40:05 +0200
parents 58b3984db931
children 0adaafd9d6e8
files materials/info.php
diffstat 1 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/materials/info.php	Sun Mar 08 02:11:33 2015 +0200
+++ b/materials/info.php	Sun Mar 08 02:40:05 2015 +0200
@@ -107,10 +107,20 @@
 
 foreach ($typeTable as $key => $value)
 {
-  echo
-    "    <option value=\"$key\"".
-    ($showOnly == $key ? " selected=\"selected\"" : "").
-    ">".chentities($value[0])."</option>\n";
+  $n = 0;
+  foreach ($matTable as $name => $data)
+  {
+    if ($data[14] == $value[1] || $data[14] == $value[2])
+      $n++;
+  }
+
+  $typeTable[$key][] = $n;
+
+  printf(
+    "    <option value=\"%s\"%s>%-30s [%d]</option>\n",
+    $key,
+    ($showOnly == $key ? " selected=\"selected\"" : ""),
+    chentities($value[0]), $n);
 }
 
 ?>
@@ -272,6 +282,9 @@
   }
   echo " </tr>\n";
 
+  $researched = 0;
+  $researchValue = 0;
+
   foreach ($currTable as $mat1)
   {
     echo " <tr><th>".matLink($mat1)."</th>";
@@ -296,13 +309,17 @@
           foreach ($tmp as $a => $b)
             $value += $b;
 
+          $researched++;
+          $researchValue += $value;
+
           $slist = array();
           foreach ($tmp as $a => $b)
           {
             $slist[] = matLink($a,
               $b." successful alloys (".$mat1." + ".$mat2." = ".$a.")".
-              (count($tmp) > 1 ? " [UNSTABLE]" : ""),
-              " <sup>".$b."</sup>");
+              (count($tmp) > 1 ? " [UNSTABLE]" : "")
+              );
+//              , " <sup>".$b."</sup>");
           }
           echo
             "<td".addValueStyle($value, count($tmp) > 1 ? " mitalic" : "").">".
@@ -318,7 +335,15 @@
     }  
     echo "</tr>\n";
   }
-  echo "</table>\n";
+
+  $mats = count($currTable);
+  $total = $mats * $mats - $mats;
+
+  printf("</table>\n".
+    "<div><b>%1.2f%%</b> (%d / %d) of combinations researched. ".
+    "Estimating <b>%1.2f%%</b> overall accuracy.</div>\n",
+    ($researched * 100.0) / $total, $researched, $total,
+    ($researchValue * 100.0) / ($total * 10.0));
 }
 
 cmPrintPageFooter();