@@ -92,7 +92,9 @@ export class ImportUploadSubscriptionDetailsService {
92
92
private persistEntry (
93
93
entry : SubscriptionDetailImportEntry ,
94
94
) : Observable < SubscriptionDetailImportEntry > {
95
- if ( entry . entry . value === entry . data . subscriptionDetail ?. Value ) {
95
+ if (
96
+ this . getNormalizedValue ( entry ) == entry . data . subscriptionDetail ?. Value
97
+ ) {
96
98
// Ignore entry with an unchanged value
97
99
this . markSuccessEntry ( entry ) ;
98
100
return of ( entry ) ;
@@ -114,15 +116,14 @@ export class ImportUploadSubscriptionDetailsService {
114
116
) ;
115
117
}
116
118
117
- private updateSubscriptionDetail ( {
118
- entry,
119
- data : { subscriptionDetail } ,
120
- } : SubscriptionDetailImportEntry ) : Observable < void > {
121
- if ( ! subscriptionDetail )
119
+ private updateSubscriptionDetail (
120
+ entry : SubscriptionDetailImportEntry ,
121
+ ) : Observable < void > {
122
+ if ( ! entry . data . subscriptionDetail )
122
123
return throwError (
123
124
( ) =>
124
125
new Error (
125
- `Subscription not present for entry: ${ JSON . stringify ( entry ) } ` ,
126
+ `Subscription not present for entry: ${ JSON . stringify ( entry . entry ) } ` ,
126
127
) ,
127
128
) ;
128
129
@@ -136,15 +137,30 @@ export class ImportUploadSubscriptionDetailsService {
136
137
// return of(undefined).pipe(delay(500 + (Math.random() - 0.5) * 300));
137
138
138
139
return this . subscriptionDetailsService . update (
139
- subscriptionDetail ,
140
+ entry . data . subscriptionDetail ,
140
141
// eslint-disable-next-line @typescript-eslint/no-explicit-any
141
- entry . value as any ,
142
+ this . getNormalizedValue ( entry ) as any ,
142
143
new HttpContext ( ) . set ( RestErrorInterceptorOptions , {
143
144
disableErrorHandling : true ,
144
145
} ) ,
145
146
) ;
146
147
}
147
148
149
+ private getNormalizedValue ( {
150
+ entry,
151
+ data : { subscriptionDetail } ,
152
+ } : SubscriptionDetailImportEntry ) : unknown {
153
+ if ( Array . isArray ( subscriptionDetail ?. DropdownItems ) ) {
154
+ const item = subscriptionDetail . DropdownItems . find (
155
+ ( item ) => item . Value === entry . value ,
156
+ ) ;
157
+ if ( item ) {
158
+ return item . Key ;
159
+ }
160
+ }
161
+ return entry . value ;
162
+ }
163
+
148
164
private markSuccessEntry ( entry : SubscriptionDetailImportEntry ) : void {
149
165
entry . importStatus = "success" ;
150
166
entry . importError = null ;
0 commit comments