@@ -18,9 +18,14 @@ let workloadDownloadModal = function (WorkloadSummaryActions) {
18
18
scope . showSnapshotWarning = false ;
19
19
20
20
scope . $watch ( 'userWorkgroupSnapshots' , function ( userWorkgroupsSnapshots ) {
21
- if ( localStorage . getItem ( "workloadSnapshotDownloadSelections" ) ) {
22
- scope . departmentSnapshots = JSON . parse ( localStorage . getItem ( "workloadSnapshotDownloadSelections" ) ) ;
23
- scope . isSortedByRecentActivity = JSON . parse ( localStorage . getItem ( "workloadSnapshotDownloadSorted" ) ) ;
21
+ const workloadSnapshotDownloadSettings = JSON . parse ( localStorage . getItem ( 'workloadSnapshotDownloadSettings' ) ) ;
22
+
23
+ if (
24
+ workloadSnapshotDownloadSettings ?. year === scope . year &&
25
+ workloadSnapshotDownloadSettings ?. snapshots . length === Object . keys ( userWorkgroupsSnapshots ?? { } ) . length
26
+ ) {
27
+ scope . departmentSnapshots = workloadSnapshotDownloadSettings . snapshots ;
28
+ scope . isSortedByRecentActivity = workloadSnapshotDownloadSettings . isSorted ;
24
29
} else if ( userWorkgroupsSnapshots ) {
25
30
scope . departmentSnapshots = scope . getScenarioOptions ( userWorkgroupsSnapshots ) ;
26
31
scope . showSnapshotWarning = scope . isAnyWorkgroupMissingSnapshots ( userWorkgroupsSnapshots ) ;
@@ -105,8 +110,12 @@ let workloadDownloadModal = function (WorkloadSummaryActions) {
105
110
scope . close = function ( ) {
106
111
scope . status = null ;
107
112
WorkloadSummaryActions . toggleDownloadModal ( ) ;
108
- localStorage . setItem ( "workloadSnapshotDownloadSelections" , JSON . stringify ( scope . departmentSnapshots ) ) ;
109
- localStorage . setItem ( "workloadSnapshotDownloadSorted" , JSON . stringify ( scope . isSortedByRecentActivity ) ) ;
113
+ localStorage . setItem ( 'workloadSnapshotDownloadSettings' , JSON . stringify ( {
114
+ snapshots : scope . departmentSnapshots ,
115
+ year : scope . year ,
116
+ isSorted : scope . isSortedByRecentActivity
117
+ } )
118
+ ) ;
110
119
} ;
111
120
112
121
scope . submit = function ( ) {
0 commit comments