Skip to content

fix: for issue #2069 #4893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SubTrackChallengeView extends React.Component {
this.state = {
// this is current page number. starts with 0.
// everytime we scroll at the bottom, we query from offset = pageNum * CHALLENGE_PER_PAGE
pageNum: 0,
pageNum: 1,
// which challenge's modal should be poped. null means no modal
challengeIndexToPopModal: null,
};
Expand All @@ -140,6 +140,10 @@ class SubTrackChallengeView extends React.Component {
userId,
} = this.props;

const {
pageNum,
} = this.state;

if (track === 'DEVELOP' || track === 'DESIGN') {
if (!loadingSubTrackChallengesUUID) {
loadSubtrackChallenges(
Expand All @@ -159,7 +163,7 @@ class SubTrackChallengeView extends React.Component {
}
} else if (subTrack === 'MARATHON_MATCH') {
if (!loadingMarathonUUID) {
loadMarathon(handle, auth.tokenV3, 0, CHALLENGE_PER_PAGE, true);
loadMarathon(handle, userId, auth.tokenV3, pageNum, CHALLENGE_PER_PAGE, true);
}
}
}
Expand Down Expand Up @@ -209,7 +213,7 @@ class SubTrackChallengeView extends React.Component {
}
} else if (subTrack === 'MARATHON_MATCH') {
if (!loadingMarathonUUID) {
loadMarathon(handle, auth.tokenV3, pageNum + 1, CHALLENGE_PER_PAGE, false);
loadMarathon(handle, userId, auth.tokenV3, pageNum + 1, CHALLENGE_PER_PAGE, false);
this.setState({ pageNum: pageNum + 1 });
}
}
Expand Down Expand Up @@ -347,7 +351,6 @@ class SubTrackChallengeView extends React.Component {
userMarathons,
item => ({
...item,
submissionEndDate: _.get(item, 'rounds.0.systemTestEndAt'),
pointTotal: _.get(item, 'rounds.0.userMMDetails.pointTotal'),
}),
);
Expand Down Expand Up @@ -440,10 +443,18 @@ function mapDispatchToProps(dispatch) {
dispatch(action.getUserSrmInit(handle, uuid));
dispatch(action.getUserSrmDone(uuid, handle, tokenV3, pageNum, pageSize, refresh));
},
loadMarathon: (handle, tokenV3, pageNum, pageSize, refresh) => {
loadMarathon: (handle, memberId, tokenV3, pageNum, pageSize, refresh) => {
const uuid = shortId();
dispatch(action.getUserMarathonInit(handle, uuid));
dispatch(action.getUserMarathonDone(uuid, handle, tokenV3, pageNum, pageSize, refresh));
dispatch(action.getUserMarathonDone(
uuid,
handle,
memberId,
tokenV3,
pageNum,
pageSize,
refresh,
));
},
};
}
Expand Down