@@ -422,36 +422,42 @@ export class ProgressStore {
422422 let stored = localStorage . getItem ( 'dataset' ) ;
423423 let completeTitle : ProgressTitle = this . getCompletedProgressTitle ( ) ;
424424 if ( stored ) {
425- try {
426- const legacyDataset = JSON . parse ( stored ) ;
427-
428- legacyDataset . forEach ( ( entry : any ) => {
429- const legacyActivities = entry . Activity ;
430-
431- if ( Array . isArray ( legacyActivities ) ) {
432- legacyActivities . forEach ( ( legacyActivity : any ) => {
433- const activityUuid = legacyActivity . uuid ;
434- const teamsImplemented = legacyActivity . teamsImplemented ;
435- if ( teamsImplemented ) {
436- Object . keys ( teamsImplemented ) . forEach ( ( team : string ) => {
437- if ( legacyActivity . teamsImplemented [ team ] ) {
438- if ( ! progress ! [ activityUuid ] ) {
439- progress ! [ activityUuid ] = { } ;
440- }
441- if ( ! progress ! [ activityUuid ] [ team ] ) {
442- progress ! [ activityUuid ] [ team ] = { } ;
443- }
444- console . log ( `Legacy import: Setting '${ completeTitle } ' on ${ activityUuid } for ${ team } ` ) ;
445- progress ! [ activityUuid ] [ team ] [ completeTitle ] = new Date ( ) ;
446- }
447- } ) ;
448- }
449- } ) ;
450- }
425+ try {
426+ const legacyDataset = JSON . parse ( stored ) ;
427+
428+ legacyDataset . forEach ( ( entry : any ) => {
429+ const legacyActivities = entry . Activity ;
430+
431+ if ( Array . isArray ( legacyActivities ) ) {
432+ legacyActivities . forEach ( ( legacyActivity : any ) => {
433+ const activityUuid = legacyActivity . uuid ;
434+ const teamsImplemented = legacyActivity . teamsImplemented ;
435+ if ( teamsImplemented ) {
436+ Object . keys ( teamsImplemented ) . forEach ( ( team : string ) => {
437+ if ( legacyActivity . teamsImplemented [ team ] ) {
438+ if ( ! progress ! [ activityUuid ] ) {
439+ progress ! [ activityUuid ] = { } ;
440+ }
441+ if ( ! progress ! [ activityUuid ] [ team ] ) {
442+ progress ! [ activityUuid ] [ team ] = { } ;
443+ }
444+ console . log ( `Legacy import: Setting '${ completeTitle } ' on ${ activityUuid } for ${ team } ` ) ; // eslint-disable-line
445+ progress ! [ activityUuid ] [ team ] [ completeTitle ] = new Date ( ) ;
446+ }
447+ } ) ;
448+ }
451449 } ) ;
452- } catch ( error ) {
453- console . error ( "Failed to parse legacy dataset" , error ) ;
454- }
450+ }
451+ } ) ;
452+ } catch ( error ) {
453+ console . error ( 'Failed to parse legacy progress: ' , error ) ;
454+ throw Error (
455+ 'Failed to parse legacy DSOMM team progress.' +
456+ ' You may attempt fixing or clearing your browser storage and try again.' +
457+ '\n\nThe localStorage `dataset` gives the error: \n\n' +
458+ error
459+ ) ;
460+ }
455461 }
456462 return progressFile ;
457463 }
0 commit comments