Skip to content

Issue #4537 : Challenge Details - Registrants data bind #4543

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 1 commit into from
Jun 16, 2020
Merged
Changes from all commits
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
24 changes: 12 additions & 12 deletions src/shared/components/challenge-detail/Registrants/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function formatDate(date) {
}

function getDate(arr, handle) {
const results = arr.filter(a => _.toString(a.submitter || a.handle) === _.toString(handle))
const results = arr.filter(a => _.toString(a.submitter || a.memberHandle) === _.toString(handle))
.sort((a, b) => new Date(b.submissionTime || b.submissionDate).getTime()
- new Date(a.submissionTime || a.submissionDate).getTime());
return results[0] ? (results[0].submissionTime || results[0].submissionDate) : '';
Expand All @@ -32,7 +32,7 @@ function passedCheckpoint(checkpoints, handle, results) {
}

function getPlace(results, handle, places) {
const found = _.find(results, w => _.toString(w.handle) === _.toString(handle)
const found = _.find(results, w => _.toString(w.memberHandle) === _.toString(handle)
&& w.placement <= places && w.submissionStatus !== 'Failed Review');

if (found) {
Expand Down Expand Up @@ -99,7 +99,7 @@ export default class Registrants extends React.Component {

let checkpoint;
if (twoRounds) {
checkpoint = getDate(checkpoints, registrant.handle);
checkpoint = getDate(checkpoints, registrant.memberHandle);
if (!checkpoint
&& moment(registrant.submissionDate).isBefore(checkpointDate)) {
checkpoint = registrant.submissionDate;
Expand Down Expand Up @@ -188,8 +188,8 @@ export default class Registrants extends React.Component {
break;
}
case 'Username': {
valueA = `${a.handle}`.toLowerCase();
valueB = `${b.handle}`.toLowerCase();
valueA = `${a.memberHandle}`.toLowerCase();
valueB = `${b.memberHandle}`.toLowerCase();
valueIsString = true;
break;
}
Expand Down Expand Up @@ -381,7 +381,7 @@ export default class Registrants extends React.Component {
<div styleName="body" role="rowgroup">
{
sortedRegistrants.map((r) => {
const placement = getPlace(results, r.handle, places);
const placement = getPlace(results, r.memberHandle, places);
const colorStyle = JSON.parse(r.colorStyle.replace(/(\w+):\s*([^;]*)/g, '{"$1": "$2"}'));
let checkpoint = this.getCheckPoint(r);
if (checkpoint) {
Expand All @@ -395,7 +395,7 @@ export default class Registrants extends React.Component {
}

return (
<div styleName="row" key={r.handle} role="row">
<div styleName="row" key={r.memberHandle} role="row">
{
!isDesign && !isF2F && !isBugHunt && (
<div styleName="col-2">
Expand All @@ -413,19 +413,19 @@ export default class Registrants extends React.Component {
<div styleName="col-3">
<span role="cell">
<a
href={`${window.origin}/members/${r.handle}`}
href={`${window.origin}/members/${r.memberHandle}`}
style={colorStyle}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
>
{r.handle}
{r.memberHandle}
</a>
</span>
</div>
<div styleName="col-4">
<div styleName="sm-only title">
Registration Date
</div>
<span role="cell">{formatDate(r.registrationDate)}</span>
<span role="cell">{formatDate(r.created)}</span>
</div>
{
twoRounds
Expand All @@ -439,7 +439,7 @@ export default class Registrants extends React.Component {
{checkpoint}
</span>
{
passedCheckpoint(checkpoints, r.handle, checkpointResults)
passedCheckpoint(checkpoints, r.memberHandle, checkpointResults)
&& <CheckMark styleName="passed" />
}
</div>
Expand Down Expand Up @@ -484,7 +484,7 @@ Registrants.propTypes = {
challenge: PT.shape({
phases: PT.arrayOf(PT.shape({
actualEndDate: PT.string,
phaseType: PT.string.isRequired,
name: PT.string.isRequired,
scheduledEndDate: PT.string,
})).isRequired,
allPhases: PT.arrayOf(PT.shape()),
Expand Down