Skip to content

Commit 4b7d1f9

Browse files
committed
Fix for TOP-611 / existing bug with showing submission dates when logged out
1 parent a2b891a commit 4b7d1f9

File tree

2 files changed

+20
-1
lines changed
  • src/shared

2 files changed

+20
-1
lines changed

src/shared/components/challenge-detail/Registrants/index.jsx

+19-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ export default class Registrants extends React.Component {
128128
return final;
129129
}
130130

131+
/**
132+
* Get the submission date of a registrant (used when viewing the registrants tab anonymously)
133+
* @param {Object} registrant the registrant to return the submission date for
134+
*/
135+
getSubmissionDate(registrant, statisticsData) {
136+
let submissionDate;
137+
const statistic = (statisticsData || []).find(x => x.handle === registrant.memberHandle)
138+
if(statistic && statistic.submissions && statistic.submissions.length>0){
139+
submissionDate = statistic.submissions.sort()[0].created;
140+
}
141+
return submissionDate;
142+
}
143+
131144
/**
132145
* Check if it have flag for first try
133146
* @param {Object} registrant registrant info
@@ -244,6 +257,7 @@ export default class Registrants extends React.Component {
244257
checkpointResults,
245258
results,
246259
onSortChange,
260+
statisticsData,
247261
} = this.props;
248262
const {
249263
prizeSets,
@@ -413,7 +427,10 @@ export default class Registrants extends React.Component {
413427
if (checkpoint) {
414428
checkpoint = formatDate(checkpoint);
415429
}
416-
const final = this.getFinal(r);
430+
let final = this.getFinal(r);
431+
if(!final){
432+
final = this.getSubmissionDate(r, statisticsData);
433+
}
417434

418435
return (
419436
<div styleName="row" key={r.memberHandle} role="row">
@@ -523,6 +540,7 @@ Registrants.propTypes = {
523540
type: PT.string,
524541
track: PT.string,
525542
}).isRequired,
543+
statisticsData: PT.arrayOf(PT.shape()),
526544
results: PT.arrayOf(PT.shape()),
527545
checkpointResults: PT.shape(),
528546
registrants: PT.arrayOf(PT.shape()),

src/shared/containers/challenge-detail/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ class ChallengeDetailPageContainer extends React.Component {
565565
)
566566
}
567567
results={results2}
568+
statisticsData={statisticsData}
568569
registrantsSort={registrantsSort}
569570
notFoundCountryFlagUrl={notFoundCountryFlagUrl}
570571
onGetFlagImageFail={(countryInfo) => {

0 commit comments

Comments
 (0)