@@ -416,6 +416,46 @@ export class ProgressStore {
416416 return this . yamlService . parse ( yamlStr ) ;
417417 }
418418
419+ public retrieveLegacyStoredTeamProgress ( ) : TeamProgressFile | null {
420+ let progress : Progress = { } ;
421+ let progressFile : TeamProgressFile = { progress : progress } ;
422+ let stored = localStorage . getItem ( 'dataset' ) ;
423+ let completeTitle : ProgressTitle = this . getCompletedProgressTitle ( ) ;
424+ 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+ }
451+ } ) ;
452+ } catch ( error ) {
453+ console . error ( "Failed to parse legacy dataset" , error ) ;
454+ }
455+ }
456+ return progressFile ;
457+ }
458+
419459 /**
420460 * Clear progress for a team's activity, from startIndex to endIndex.
421461 * It will store a backup of the progress in _tempProgress, in case
0 commit comments