account for as-yet-uncalculated locations in stexaminer
Tara L Andrews [Tue, 28 Aug 2012 12:15:01 +0000 (14:15 +0200)]
root/css/stexaminer.css
root/js/stexaminer.js
root/src/stexaminer.tt

index a30416a..68a5cc1 100644 (file)
@@ -60,6 +60,9 @@
 .coincidental {
     background: #fff;
 }
+.unsolved {
+       background: lightgrey;
+}
 .conflict {
     background: #ff6666;
 }
index b68c3c2..a6797e9 100644 (file)
@@ -62,24 +62,33 @@ function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) {
 function show_stats( rs ) {
        var rshtml = $('#stats_template').clone();
        rshtml.find('#statrank').append( rs.id );
-       $.each( rs.readings, function( idx, rdghash ) {
-               var rdgstats = $('#reading_template').clone();
-               rdgstats.find('.readinglabel').append( rdghash.text );
-               rdgstats.find('.reading_copied').append( rdghash.followed );
-               rdgstats.find('.reading_changed').append( rdghash.not_followed );
-               rdgstats.find('.reading_unclear').append( rdghash.follow_unknown );
-               rdgstats.find('.readingroots').append( rdghash.independent_occurrence );
-               if( rdghash.is_reverted ) {
-                       rdgstats.find('.reversionroots').append( rdghash.reversions );
-               } else {
-                       rdgstats.find('.readingreversions').empty();
-               }
-               rdgstats.find('.reading_statistics').append( 
-                       fill_parent_template( rdghash, 'source' ) );
-               rdgstats.find('.reading_statistics').append( 
-                       fill_parent_template( rdghash, 'reversion' ) );
-               rshtml.append( rdgstats.contents() );
-       });
+       if( "unsolved" in rs ) {
+               rshtml.find('.solutionstatus').append(
+                       "(Not yet calculated for this location - please try later)");
+       } else {
+               $.each( rs.readings, function( idx, rdghash ) {
+                       var rdgstats = $('#reading_template').clone();
+                       rdgstats.find('.readinglabel').append( rdghash.text );
+                       rdgstats.find('.reading_copied').append( rdghash.followed );
+                       rdgstats.find('.reading_changed').append( rdghash.not_followed );
+                       rdgstats.find('.reading_unclear').append( rdghash.follow_unknown );
+                       rdgstats.find('.readingroots').append( rdghash.independent_occurrence );
+                       if( rdghash.is_reverted ) {
+                               rdgstats.find('.reversionroots').append( rdghash.reversions );
+                       } else {
+                               rdgstats.find('.readingreversions').empty();
+                       }
+                       var rdgsourcehtml = fill_parent_template( rdghash, 'source' );
+                       var rdgreverthtml = fill_parent_template( rdghash, 'reversion' );
+                       rdgstats.find('.reading_statistics').append( rdgsourcehtml );
+                       rdgstats.find('.reading_statistics').append( rdgreverthtml );
+                       // If neither, append a small spacer
+                       if( !rdgsourcehtml && !rdgreverthtml ) {
+                               rdgstats.find('.reading_statistics').append( '<br/>' );
+                       }
+                       rshtml.append( rdgstats.contents() );
+               });
+       }
        $('#row_statistics').empty();
        $('#row_statistics').append( rshtml.contents() );
        
index d122ca0..379e9f9 100644 (file)
@@ -42,6 +42,7 @@ var graphdot = '[% graphdot %]';
     <div id="stats_template" class="template">
            <h3>Statistics for readings at <span id="statrank"></span>:</h3>
            <!-- reading_template will be appended here for each reading -->
+           <span class="solutionstatus"></span>
     </div>
     
        <div id="reading_template" class="template">
@@ -85,9 +86,10 @@ var graphdot = '[% graphdot %]';
     
 
 [% BLOCK variantrow -%]
-[% SET rowclass = 'class="coincidental"' -%]
-[% SET rowclass = 'class="genealogical"' IF row.genealogical -%]
-        <tr [% rowclass %]>
+[% SET rowclass = 'coincidental' -%]
+[% SET rowclass = 'genealogical' IF row.genealogical -%]
+[% SET rowclass = "$rowclass unsolved" IF row.unsolved -%]
+        <tr class="[% rowclass %]">
           <th><span class="rowid" onclick="handle_row_click($(this))">[% row.id %]</span></th>
 [% FOREACH reading IN row.readings -%]
 [% SET cellclass = 'clickable' -%]