Skip to content

Commit

Permalink
Fix for TOP-611 / existing bug with showing submission dates when log…
Browse files Browse the repository at this point in the history
…ged out
  • Loading branch information
jmgasper committed Apr 7, 2024
1 parent a2b891a commit 4b7d1f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/shared/components/challenge-detail/Registrants/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ export default class Registrants extends React.Component {
return final;
}

/**
* Get the submission date of a registrant (used when viewing the registrants tab anonymously)
* @param {Object} registrant the registrant to return the submission date for
*/
getSubmissionDate(registrant, statisticsData) {
let submissionDate;
const statistic = (statisticsData || []).find(x => x.handle === registrant.memberHandle)
if(statistic && statistic.submissions && statistic.submissions.length>0){
submissionDate = statistic.submissions.sort()[0].created;
}
return submissionDate;
}

/**
* Check if it have flag for first try
* @param {Object} registrant registrant info
Expand Down Expand Up @@ -244,6 +257,7 @@ export default class Registrants extends React.Component {
checkpointResults,
results,
onSortChange,
statisticsData,
} = this.props;
const {
prizeSets,
Expand Down Expand Up @@ -413,7 +427,10 @@ export default class Registrants extends React.Component {
if (checkpoint) {
checkpoint = formatDate(checkpoint);
}
const final = this.getFinal(r);
let final = this.getFinal(r);
if(!final){
final = this.getSubmissionDate(r, statisticsData);
}

return (
<div styleName="row" key={r.memberHandle} role="row">
Expand Down Expand Up @@ -523,6 +540,7 @@ Registrants.propTypes = {
type: PT.string,
track: PT.string,
}).isRequired,
statisticsData: PT.arrayOf(PT.shape()),
results: PT.arrayOf(PT.shape()),
checkpointResults: PT.shape(),
registrants: PT.arrayOf(PT.shape()),
Expand Down
1 change: 1 addition & 0 deletions src/shared/containers/challenge-detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ class ChallengeDetailPageContainer extends React.Component {
)
}
results={results2}
statisticsData={statisticsData}
registrantsSort={registrantsSort}
notFoundCountryFlagUrl={notFoundCountryFlagUrl}
onGetFlagImageFail={(countryInfo) => {
Expand Down

0 comments on commit 4b7d1f9

Please sign in to comment.