@@ -111,10 +111,8 @@ const processPastChallenge = (challenge) => {
111
111
class SubTrackChallengeView extends React . Component {
112
112
constructor ( props , context ) {
113
113
super ( props , context ) ;
114
- // this is current page number. starts with 0.
115
- // everytime we scroll at the bottom, we query from offset = pageNum * CHALLENGE_PER_PAGE
116
114
this . state = {
117
- // this is current page number. starts with 0 .
115
+ // this is current page number. starts with 1 .
118
116
// everytime we scroll at the bottom, we query from offset = pageNum * CHALLENGE_PER_PAGE
119
117
pageNum : 1 ,
120
118
// which challenge's modal should be poped. null means no modal
@@ -150,7 +148,7 @@ class SubTrackChallengeView extends React.Component {
150
148
handle ,
151
149
auth . tokenV3 ,
152
150
track , subTrack ,
153
- 0 ,
151
+ pageNum ,
154
152
CHALLENGE_PER_PAGE ,
155
153
true ,
156
154
userId ,
@@ -159,7 +157,8 @@ class SubTrackChallengeView extends React.Component {
159
157
} else if ( track === 'DATA_SCIENCE' ) {
160
158
if ( subTrack === 'SRM' ) {
161
159
if ( ! loadingSRMUUID ) {
162
- loadSRM ( handle , auth . tokenV3 , 0 , CHALLENGE_PER_PAGE , true ) ;
160
+ // pageNum - 1 to match with v4 offset
161
+ loadSRM ( handle , auth . tokenV3 , pageNum - 1 , CHALLENGE_PER_PAGE , true ) ;
163
162
}
164
163
} else if ( subTrack === 'MARATHON_MATCH' ) {
165
164
if ( ! loadingMarathonUUID ) {
@@ -208,7 +207,7 @@ class SubTrackChallengeView extends React.Component {
208
207
} else if ( track === 'DATA_SCIENCE' ) {
209
208
if ( subTrack === 'SRM' ) {
210
209
if ( ! loadingSRMUUID ) {
211
- loadSRM ( handle , auth . tokenV3 , pageNum + 1 , CHALLENGE_PER_PAGE , false ) ;
210
+ loadSRM ( handle , auth . tokenV3 , pageNum , CHALLENGE_PER_PAGE , false ) ;
212
211
this . setState ( { pageNum : pageNum + 1 } ) ;
213
212
}
214
213
} else if ( subTrack === 'MARATHON_MATCH' ) {
@@ -249,7 +248,7 @@ class SubTrackChallengeView extends React.Component {
249
248
userId,
250
249
} = this . props ;
251
250
252
- if ( pageNum === 0
251
+ if ( pageNum === 1
253
252
&& ( loadingSubTrackChallengesUUID || loadingSRMUUID || loadingMarathonUUID ) ) {
254
253
return < LoadingIndicator /> ;
255
254
}
0 commit comments