@@ -186,12 +186,13 @@ function onGetActiveChallengesDone(state, { error, payload }) {
186
186
? item => ! ids . has ( item . id )
187
187
: item => ! ids . has ( item . id ) && item . status !== 'ACTIVE' ;
188
188
189
+ const data = processBucketData (
190
+ handle , state . challenges , loaded ,
191
+ bucket , state . sorts , sort , filter , frontFilter ,
192
+ ) ;
193
+
189
194
newChallenges = _ . cloneDeep ( state . challenges ) ;
190
- let oldData = newChallenges [ bucket ] ;
191
- if ( ! oldData ) {
192
- oldData = [ ] ;
193
- }
194
- newChallenges [ bucket ] = [ ...oldData , ...payload . challenges ] ;
195
+ newChallenges [ bucket ] = data ;
195
196
otherState . loadingMyChallengesUUID = '' ;
196
197
otherState . allMyChallengesLoaded = newChallenges [ bucket ] . length === meta . myChallengesCount ;
197
198
otherState . gettingMoreMyChallenges = ! otherState . allMyChallengesLoaded ;
@@ -216,13 +217,6 @@ function onGetActiveChallengesDone(state, { error, payload }) {
216
217
otherState . allOpenChallengesLoaded = checkAllLoaded ( state . challenges , bucket , loaded , data ) ;
217
218
otherState . gettingMoreOpenChallenges = ! otherState . allOpenChallengesLoaded ;
218
219
otherState . meta = _ . clone ( meta ) ;
219
- /* TODO Due to the meta of backend response is currently not correct,
220
- /* so should update counts after fetch all challenges of bucket */
221
- if ( _ . get ( meta , 'openChallengesCount' ) !== data . length && otherState . allOpenChallengesLoaded ) {
222
- otherState . meta . openChallengesCount = data . length ;
223
- otherState . meta . allChallengesCount = meta . allChallengesCount
224
- + data . length - meta . openChallengesCount ;
225
- }
226
220
}
227
221
break ;
228
222
case BUCKETS . ONGOING : {
@@ -242,14 +236,7 @@ function onGetActiveChallengesDone(state, { error, payload }) {
242
236
otherState . allOnGoingChallengesLoaded = checkAllLoaded ( state . challenges ,
243
237
bucket , loaded , data ) ;
244
238
otherState . gettingMoreOnGoingChallenges = ! otherState . allOnGoingChallengesLoaded ;
245
- /* TODO Due to the meta of backend response is currently not correct,
246
- /* so should update counts after fetch all challenges of bucket */
247
239
otherState . meta = _ . clone ( meta ) ;
248
- if ( _ . get ( meta , 'ongoingChallengesCount' ) !== data . length && otherState . allOnGoingChallengesLoaded ) {
249
- otherState . meta . ongoingChallengesCount = data . length ;
250
- otherState . meta . allChallengesCount = meta . allChallengesCount
251
- + data . length - meta . ongoingChallengesCount ;
252
- }
253
240
}
254
241
break ;
255
242
default :
0 commit comments