File tree 4 files changed +20
-40
lines changed
4 files changed +20
-40
lines changed Original file line number Diff line number Diff line change @@ -83,14 +83,14 @@ workflows:
83
83
branches :
84
84
only :
85
85
- dev
86
- - fix/schema
86
+ - fix/search
87
87
88
88
- " build-qa " :
89
89
context : org-global
90
90
filters :
91
91
branches :
92
92
only :
93
- - refactor/domain-challenge
93
+ - qa
94
94
95
95
# Production builds are exectuted only on tagged commits to the
96
96
# master branch.
Original file line number Diff line number Diff line change @@ -22,13 +22,11 @@ Dev: [
24
24
- [ ES Processor] ( https://github.com/topcoder-platform/challenge-processor-es ) - Updates data in ElasticSearch
25
- - [ Legacy Processor] ( https://github.com/topcoder-platform/legacy-challenge-processor ) - Moves data from DynamoDB back to Informix
26
- - [ Legacy Migration Script] ( https://github.com/topcoder-platform/legacy-challenge-migration-script ) - Moves data from Informix to DynamoDB
27
- - [ Frontend App] ( https://github.com/topcoder-platform/challenge-engine-ui )
25
+ - [ Domain Challenge] ( https://github.com/topcoder-platform/domain-challenge ) - Domain Challenge
28
26
29
27
## Prerequisites
30
28
31
- - [ NodeJS] ( https://nodejs.org/en/ ) (v10 )
29
+ - [ NodeJS] ( https://nodejs.org/en/ ) (v18+ )
32
30
- [ AWS S3] ( https://aws.amazon.com/s3/ )
33
31
- [ Elasticsearch v6] ( https://www.elastic.co/ )
34
32
- [ Docker] ( https://www.docker.com/ )
Original file line number Diff line number Diff line change @@ -754,36 +754,21 @@ function calculateChallengeEndDate(challenge, data) {
754
754
async function listChallengesByMember ( memberId ) {
755
755
const token = await m2mHelper . getM2MToken ( ) ;
756
756
let allIds = [ ] ;
757
- // get search is paginated, we need to get all pages' data
758
- let page = 1 ;
759
- while ( true ) {
760
- let result = { } ;
761
- try {
762
- result = await axios . get ( `${ config . RESOURCES_API_URL } /${ memberId } /challenges` , {
763
- headers : { Authorization : `Bearer ${ token } ` } ,
764
- params : {
765
- page,
766
- perPage : 10000 ,
767
- } ,
768
- } ) ;
769
- } catch ( e ) {
770
- // only log the error but don't throw it, so the following logic can still be executed.
771
- logger . debug ( `Failed to get challenges that accessible to the memberId ${ memberId } ` , e ) ;
772
- }
773
- const ids = result . data || [ ] ;
774
- if ( ids . length === 0 ) {
775
- break ;
776
- }
777
- allIds = allIds . concat ( ids ) ;
778
- page += 1 ;
779
- if (
780
- result . headers &&
781
- result . headers [ "x-total-pages" ] &&
782
- page > Number ( result . headers [ "x-total-pages" ] )
783
- ) {
784
- break ;
785
- }
757
+
758
+ try {
759
+ const result = await axios . get ( `${ config . RESOURCES_API_URL } /${ memberId } /challenges` , {
760
+ headers : { Authorization : `Bearer ${ token } ` } ,
761
+ params : {
762
+ useScroll : true ,
763
+ } ,
764
+ } ) ;
765
+
766
+ allIds = result . data || [ ] ;
767
+ } catch ( e ) {
768
+ // only log the error but don't throw it, so the following logic can still be executed.
769
+ logger . debug ( `Failed to get challenges that accessible to the memberId ${ memberId } ` , e ) ;
786
770
}
771
+
787
772
return allIds ;
788
773
}
789
774
Original file line number Diff line number Diff line change @@ -149,7 +149,6 @@ async function searchChallenges(currentUser, criteria) {
149
149
_ . includes ( config . SELF_SERVICE_WHITELIST_HANDLES , currentUser . handle . toLowerCase ( ) ) ) ;
150
150
151
151
const includedTrackIds = _ . isArray ( criteria . trackIds ) ? criteria . trackIds : [ ] ;
152
-
153
152
const includedTypeIds = _ . isArray ( criteria . typeIds ) ? criteria . typeIds : [ ] ;
154
153
155
154
if ( criteria . type ) {
@@ -168,7 +167,6 @@ async function searchChallenges(currentUser, criteria) {
168
167
criteria . trackId = _ . get ( trackSearchRes , "result[0].id" ) ;
169
168
}
170
169
}
171
-
172
170
if ( criteria . types ) {
173
171
for ( const t of criteria . types ) {
174
172
const typeSearchRes = await ChallengeTypeService . searchChallengeTypes ( { abbreviation : t } ) ;
@@ -187,7 +185,6 @@ async function searchChallenges(currentUser, criteria) {
187
185
}
188
186
}
189
187
}
190
-
191
188
if ( criteria . typeId ) {
192
189
includedTypeIds . push ( criteria . typeId ) ;
193
190
}
@@ -604,10 +601,10 @@ async function searchChallenges(currentUser, criteria) {
604
601
match_phrase : { "task.isAssigned" : criteria . taskIsAssigned } ,
605
602
} ) ;
606
603
}
607
- if ( criteria . taskMemberId || criteria . memberId ) {
604
+ if ( criteria . taskMemberId ) {
608
605
boolQuery . push ( {
609
606
match_phrase : {
610
- "task.memberId" : criteria . taskMemberId || criteria . memberId ,
607
+ "task.memberId" : criteria . taskMemberId ,
611
608
} ,
612
609
} ) ;
613
610
}
You can’t perform that action at this time.
0 commit comments