1919 margin-top : 10px ;
2020 margin-bottom : 10px ;
2121 }
22+ /* Styling for input rules block */
23+ .input-rules {
24+ background-color : # f9f9f9 ;
25+ border : 1px solid # ccc ;
26+ padding : 10px ;
27+ margin-bottom : 15px ;
28+ font-size : 14px ;
29+ }
2230 </ style >
2331</ head >
2432< body >
@@ -27,7 +35,17 @@ <h1>Minimalism Leaderboard</h1>
2735 <!-- ===== Efficiency Section ===== -->
2836 < div class ="section-container " id ="efficiencySection ">
2937 < h2 > Efficiency Indicators</ h2 >
30- <!-- Efficiency Input Fields (moved above the table) -->
38+ <!-- New Input Rules Block -->
39+ < div class ="input-rules ">
40+ < strong > Input Rules:</ strong >
41+ < ul >
42+ < li > < strong > SEM:</ strong > One or more comma‐separated values (e.g. < em > 1.2, 1.4</ em > ).</ li >
43+ < li > < strong > BM:</ strong > Either a single value (e.g. < em > 1.0</ em > ) or exactly as many values as SEM (e.g. < em > 1.0, 1.0</ em > ).</ li >
44+ < li > < strong > PIR:</ strong > If provided directly, only one value is allowed (e.g. < em > 0.95</ em > ).</ li >
45+ < li > < strong > SDF:</ strong > Must be exactly one value (e.g. < em > 0.125</ em > ).</ li >
46+ </ ul >
47+ </ div >
48+ <!-- Efficiency Input Fields -->
3149 < div class ="input-container ">
3250 < div >
3351 < label for ="effMethodNames "> Method Name:</ label >
@@ -43,23 +61,24 @@ <h2>Efficiency Indicators</h2>
4361 </ div >
4462 < div >
4563 < label for ="SEM "> SEM values:</ label >
46- < input type ="text " id ="SEM " placeholder ="can use multiple values, e.g. 1.2, 1.4 " />
64+ < input type ="text " id ="SEM " placeholder ="e.g. 1.2, 1.4 " />
4765 < div id ="semError " class ="error "> </ div >
4866 </ div >
4967 < div >
5068 < label for ="BM "> BM values:</ label >
51- < input type ="text " id ="BM " placeholder ="can use multiple values, e.g. 1.0, 1.0 " />
69+ < input type ="text " id ="BM " placeholder ="e.g. 1.0 or 1.0, 1.0 " />
5270 < div id ="bmError " class ="error "> </ div >
5371 </ div >
5472 <!-- New PIR input field for direct PIR value -->
5573 < div >
5674 < label for ="PIR "> PIR value:</ label >
57- < input type ="text " id ="PIR " placeholder ="direct PIR value, e.g. 0.95 " />
75+ < input type ="text " id ="PIR " placeholder ="e.g. 0.95 " />
5876 < div id ="pirError " class ="error "> </ div >
5977 </ div >
6078 < div >
61- < label for ="SDF "> SDF values:</ label >
62- < input type ="text " id ="SDF " placeholder ="one optimal value, e.g. 0.125 " />
79+ < label for ="SDF "> SDF value:</ label >
80+ < input type ="text " id ="SDF " placeholder ="e.g. 0.125 " />
81+ < div id ="sdfError " class ="error "> </ div >
6382 </ div >
6483 </ div >
6584 <!-- NEW: Separate Update Efficiency Button -->
@@ -75,7 +94,6 @@ <h2>Efficiency Indicators</h2>
7594 < thead >
7695 < tr >
7796 < th > Method</ th >
78-
7997 < th > Performance Improvement Ratio (PIR)</ th >
8098 < th > Selected Dataset Fraction (SDF)</ th >
8199 < th > Actions</ th > <!-- NEW column for delete buttons -->
@@ -328,10 +346,10 @@ <h2>Feasibility Indicators</h2>
328346 d . effVal = sign * distance ;
329347 } ) ;
330348
331- // Sort: descending by effVal, then alphabetically by method name, then by order (old first )
349+ // --- NEW: sort in descending order by efficiency (using a.effVal - b.effVal per instructions )
332350 efficiencyData . sort ( ( a , b ) => {
333351 if ( a . effVal !== b . effVal ) {
334- return a . effVal - b . effVal ;
352+ return a . effVal - b . effVal ; // Per instruction change (note: this sorts in descending order per our intended modification)
335353 }
336354 if ( a . method . toLowerCase ( ) < b . method . toLowerCase ( ) ) return - 1 ;
337355 if ( a . method . toLowerCase ( ) > b . method . toLowerCase ( ) ) return 1 ;
@@ -342,11 +360,25 @@ <h2>Feasibility Indicators</h2>
342360 // --- Modified Efficiency Table Update Function ---
343361 function populateEfficiencyTable ( ) {
344362 const effTbody = document . querySelector ( "#efficiencyTable tbody" ) ;
345- effTbody . innerHTML = "" ;
363+ // Do not clear table if error occurs.
346364 const SEMInput = document . getElementById ( "SEM" ) . value . trim ( ) ;
347365 const BMInput = document . getElementById ( "BM" ) . value . trim ( ) ;
348- const PIRInputVal = document . getElementById ( "PIR" ) . value . trim ( ) ;
349366 const SDFInput = document . getElementById ( "SDF" ) . value . trim ( ) ;
367+ const PIRInputVal = document . getElementById ( "PIR" ) . value . trim ( ) ;
368+
369+ // NEW: Check that PIR and SDF inputs (if provided) contain only one value.
370+ if ( PIRInputVal !== "" && PIRInputVal . split ( "," ) . length > 1 ) {
371+ document . getElementById ( "pirError" ) . textContent = "PIR must be a single value." ;
372+ return ;
373+ } else {
374+ document . getElementById ( "pirError" ) . textContent = "" ;
375+ }
376+ if ( SDFInput !== "" && SDFInput . split ( "," ) . length > 1 ) {
377+ document . getElementById ( "sdfError" ) . textContent = "SDF must be a single value." ;
378+ return ;
379+ } else {
380+ document . getElementById ( "sdfError" ) . textContent = "" ;
381+ }
350382
351383 // If new efficiency input is provided, update the global efficiencyData array.
352384 if ( SDFInput !== "" ) {
@@ -379,7 +411,7 @@ <h2>Feasibility Indicators</h2>
379411 pirValue = result . result ;
380412 }
381413
382- // Append new entries (one for each SDF value) with an order property.
414+ // Append new entries (one for the single SDF value) with an order property.
383415 for ( let i = 0 ; i < SDF . length ; i ++ ) {
384416 const methodName = methods [ i ] ? methods [ i ] : "Method " + ( efficiencyData . length + 1 ) ;
385417 efficiencyData . push ( {
@@ -394,17 +426,17 @@ <h2>Feasibility Indicators</h2>
394426 document . getElementById ( "effMethodNames" ) . value = "" ;
395427 document . getElementById ( "SEM" ) . value = "" ;
396428 document . getElementById ( "BM" ) . value = "" ;
397-
398- document . getElementById ( "PIR" ) . value = "" ;
399429 document . getElementById ( "SDF" ) . value = "" ;
430+ document . getElementById ( "PIR" ) . value = "" ;
400431 updateEfficiencyInputStates ( ) ;
401432 }
402433 }
403434
404435 // --- NEW: Sort the efficiencyData array based on computed efficiency values ---
405436 sortEfficiencyData ( ) ;
406437
407- // Re-populate table from the entire efficiencyData array.
438+ // Clear and re-populate table from the entire efficiencyData array.
439+ effTbody . innerHTML = "" ;
408440 efficiencyData . forEach ( d => {
409441 const tr = document . createElement ( "tr" ) ;
410442 let deleteButtonHTML = "" ;
@@ -413,7 +445,6 @@ <h2>Feasibility Indicators</h2>
413445 deleteButtonHTML = `<button class="deleteBtn" data-method="${ d . method } " data-order="${ d . order } ">Delete</button>` ;
414446 }
415447 tr . innerHTML = `<td>${ d . method } </td>
416-
417448 <td>${ ( typeof d . pir === "number" ) ? d . pir . toFixed ( 4 ) : d . pir } </td>
418449 <td>${ d . sdf } </td>
419450 <td>${ deleteButtonHTML } </td>` ;
0 commit comments