File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -146,12 +146,18 @@ class ChallengesService {
146
146
} ;
147
147
const url = `${ endpoint } ?${ qs . stringify ( query ) } ` ;
148
148
const res = await this . private . apiV5 . get ( url ) . then ( checkErrorV5 ) ;
149
+ let myChallengesCount = 0 ;
150
+ if ( typeof this . private . tokenV3 !== 'undefined' ) {
151
+ const { userId } = decodeToken ( this . private . tokenV3 ) ;
152
+ myChallengesCount = await this . private . apiV5 . get ( `/resources/${ userId } /challenges` )
153
+ . then ( checkErrorV5 ) . then ( userChallenges => userChallenges . headers . get ( 'x-total' ) ) ;
154
+ }
149
155
return {
150
156
challenges : res . result || [ ] ,
151
157
totalCount : res . headers . get ( 'x-total' ) ,
152
158
meta : {
153
159
allChallengesCount : res . headers . get ( 'x-total' ) ,
154
- myChallengesCount : 0 ,
160
+ myChallengesCount,
155
161
ongoingChallengesCount : 0 ,
156
162
openChallengesCount : 0 ,
157
163
totalCount : res . headers . get ( 'x-total' ) ,
Original file line number Diff line number Diff line change @@ -127,10 +127,7 @@ function filterByEndDate(challenge, state) {
127
127
128
128
function filterByStarted ( challenge , state ) {
129
129
if ( _ . isUndefined ( state . started ) ) return true ;
130
- if ( ! challenge . phases ) {
131
- return true ;
132
- }
133
- return _ . some ( challenge . phases , { isOpen : true , name : 'Registration' } ) ;
130
+ return moment ( challenge . registrationStartDate ) . isBefore ( Date . now ( ) ) ;
134
131
}
135
132
136
133
function filterByStatus ( challenge , state ) {
You can’t perform that action at this time.
0 commit comments