@@ -445,10 +445,14 @@ function postLoadSnapShot() {
445445 const jsonData = JSON . parse ( decodedData ) ;
446446
447447 // Now jsonData contains the loaded data
448- sampleInfo = jsonData . sampleInfo ;
448+ /* sampleInfo = jsonData.sampleInfo;
449449 sampleMeasurements = jsonData.sampleMeasurements;
450450 selectedSampleInfo = jsonData.selectedSampleInfo;
451- selectedSampleMeasurements = jsonData . selectedSampleMeasurements ;
451+ selectedSampleMeasurements = jsonData.selectedSampleMeasurements;*/
452+ Object . assign ( sampleInfo , jsonData . sampleInfo ) ;
453+ Object . assign ( sampleMeasurements , jsonData . sampleMeasurements ) ;
454+ Object . assign ( selectedSampleInfo , jsonData . selectedSampleInfo ) ;
455+ Object . assign ( selectedSampleMeasurements , jsonData . selectedSampleMeasurements ) ;
452456 postLoadSnapShot ( ) ;
453457 updateChart ( ) ;
454458 return jsonData ;
@@ -773,12 +777,12 @@ function importData() {
773777 const statusParam = suppliedParams . get ( 'status' ) ;
774778 if ( statusParam ) {
775779 loadStatus ( statusParam ) ;
776- } else {
780+ } // else {
777781 const urlParam = suppliedParams . get ( 'urls' ) ;
778782 if ( urlParam ) {
779783 urls = urlParam . split ( ',' ) . map ( url => url . trim ( ) ) ; // Split comma-separated URLs
780784 }
781- }
785+ // }
782786 checkboxParameters ( suppliedParams , 'selcharts' , dataSheetNamesCheckboxes ) ;
783787 checkboxParameters ( suppliedParams , 'subcharts' , subChartNames ) ;
784788 const featuresParams = suppliedParams . get ( 'features' ) ;
@@ -1131,8 +1135,8 @@ function processExcelData(data, url, fileNumber) {
11311135 }
11321136 }
11331137 }
1134- console . log ( 'meas ' , meas , sheetName , dateSampled ) ;
1135- fred = df ;
1138+ // console.log('meas ',meas,sheetName,dateSampled);
1139+ // fred = df;
11361140 if ( 'total' in meas ) {
11371141
11381142 allSamples = Object . keys ( meas . total ) ;
@@ -1141,13 +1145,13 @@ fred = df;
11411145//fred = sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]];
11421146// if (!sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)']) {
11431147// if (sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)'] === undefined) {
1144- console . log ( 'New test: No total solids' , dateSampled , sheetName , allSamples [ 0 ] ) ;
1148+ // console.log('New test: No total solids',dateSampled, sheetName, allSamples[0]);
11451149//console.log(sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]);
11461150// Code that reads Total Solids column into physical data
11471151 if ( ! ( sampleMeasurements [ dateSampled ] ?. [ 'Physical Data' ] ?. samples ?. [ allSamples [ 0 ] ] ?. [ 'Total solids (% total sediment)' ] ) ) {
11481152col = startCol + 3 ;
11491153row = startRow - 2 ;
1150- console . log ( 'col ' , col , ' row ' , row , df [ row ] [ col ] ) ;
1154+ // console.log('col ',col,' row ',row, df[row][col]);
11511155if ( ! ( df [ row ] [ col ] === undefined ) ) {
11521156 if ( df [ row ] [ col ] . includes ( 'Total Solids (%)' ) ) {
11531157//console.log('Total Solids found column found');
@@ -1255,9 +1259,14 @@ let missingTotalSolids = true;
12551259 break ;
12561260 }
12571261 }
1262+ //console.log(sample);
1263+ if ( ! ( sample in sampleInfo [ dateSampled ] . position ) ) {
1264+ break ;
1265+ }
12581266 }
12591267 }
12601268 totalOfTotalArea = 0 ;
1269+ //console.log(meas.samples);
12611270 for ( sample in meas . samples ) {
12621271 currentPsd = meas . samples [ sample ] . psd ;
12631272 retData = psdPostProcess ( currentPsd , meas . sizes ) ;
@@ -1272,6 +1281,7 @@ let missingTotalSolids = true;
12721281 meas . samples [ sample ] . totalArea = retData [ 'totalArea' ] ;
12731282// totalOfTotalArea += retData['totalArea'];
12741283 totalSum += retData [ 'totalArea' ] ;
1284+ //console.log(totalSum);
12751285 }
12761286 meas . sizes = [ ...standard_phiSizes , 0 ] ;
12771287 }
@@ -1285,25 +1295,16 @@ let missingTotalSolids = true;
12851295 meas [ 'Date analysed' ] = dateAnalysed ;
12861296 meas [ 'Unit of measurement' ] = measurementUnit ;
12871297 meas [ 'Laboratory/contractor' ] = contractor ;
1298+ //if (sheetName === 'Physical Data') {console.log(meas,totalSum);}
12881299// if (!(sheetName === 'Physical Data')) {
12891300 if ( ! totalSum > 0 ) {
12901301 disableRadioButtons ( sortButtonGroups [ sheetName ] , true ) ;
12911302 return 'No data for ' + sheetName ;
1292- } /*else {
1293- disableRadioButtons(sortButtonGroups[sheetName], false);
1294- }*/
1295- /* }
1296- // if (sheetName === 'Physical Data' && Object.keys(meas.samples).length === 0) {
1297- if (sheetName === 'Physical Data') {
1298- if (totalOfTotalArea === 0) {
1299- return 'No data for ' + sheetName;
1300- } else {
1301- disableRadioButtons(sortButtonGroups[sheetName], false);
13021303 }
1303- }*/
13041304 //console.log(dateSampled, sheetName, 'meas ', meas);
13051305// if (!(meas.samples === undefined || meas.samples === null)) {
13061306 if ( sheetName === 'Physical Data' ) {
1307+ //console.log(meas);
13071308 for ( sample in meas . samples ) {
13081309 if ( missingVisualAppearance ) {
13091310 delete meas . samples [ sample ] [ 'Visual Appearance' ] ;
@@ -1316,6 +1317,7 @@ let missingTotalSolids = true;
13161317 }
13171318 }
13181319 }
1320+ //if (sheetName === 'Physical Data') {console.log(meas);}
13191321 sampleMeasurements [ dateSampled ] [ sheetName ] = meas ;
13201322 const sums = { } ;
13211323 //console.log(meas);
0 commit comments