Skip to content

Commit 7402fb4

Browse files
committed
fix: Add submission date to registrants
1 parent 0f7e876 commit 7402fb4

File tree

1 file changed

+64
-34
lines changed
  • src/components/ChallengeEditor/ChallengeViewTabs

1 file changed

+64
-34
lines changed

src/components/ChallengeEditor/ChallengeViewTabs/index.js

Lines changed: 64 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,23 @@ const ChallengeViewTabs = ({
4747
const { resourceRoles } = metadata
4848
const role = getResourceRoleByName(resourceRoles, 'Submitter')
4949
if (role && challengeResources) {
50-
return challengeResources.filter(resource => resource.roleId === role.id)
50+
const registrantList = challengeResources.filter(
51+
resource => resource.roleId === role.id
52+
)
53+
// Add submission date to registrants
54+
registrantList.forEach((r, i) => {
55+
const submission = (challengeSubmissions || []).find(s => {
56+
return '' + s.memberId === '' + r.memberId
57+
})
58+
if (submission) {
59+
registrantList[i].submissionDate = submission.created
60+
}
61+
})
62+
return registrantList
5163
} else {
5264
return []
5365
}
54-
}, [metadata, challengeResources])
66+
}, [metadata, challengeResources, challengeSubmissions])
5567

5668
const submissions = useMemo(() => {
5769
return _.map(challengeSubmissions, s => {
@@ -68,41 +80,59 @@ const ChallengeViewTabs = ({
6880
<div className={styles.list}>
6981
<Helmet title='View Details' />
7082
{!isTask && (
71-
<div className={cn(styles.actionButtons, styles.button, styles.actionButtonsLeft)}>
83+
<div
84+
className={cn(
85+
styles.actionButtons,
86+
styles.button,
87+
styles.actionButtonsLeft
88+
)}
89+
>
7290
<LegacyLinks challenge={challenge} challengeView />
7391
</div>
7492
)}
75-
<div className={styles.title}>View Details</div>
76-
<div className={cn(styles.actionButtons, styles.button, styles.actionButtonsRight)}>
77-
{
78-
challenge.status === 'Draft' && (
79-
<div className={styles.button}>
80-
{(challenge.legacyId || isTask) ? (
81-
<PrimaryButton text={'Launch'} type={'info'} onClick={onLaunchChallenge} />
82-
) : (
83-
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
84-
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
85-
<PrimaryButton text={'Launch'} type={'disabled'} />
86-
</Tooltip>
87-
)}
88-
</div>
89-
)
90-
}
91-
{
92-
isTask && challenge.status === 'Active' && (
93-
<div className={styles.button}>
94-
{ assignedMemberDetails ? (
95-
<PrimaryButton text={'Close Task'} type={'danger'} onClick={onCloseTask} />
96-
) : (
97-
<Tooltip content={MESSAGE.NO_TASK_ASSIGNEE}>
98-
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
99-
<PrimaryButton text={'Close Task'} type={'disabled'} />
100-
</Tooltip>
101-
)}
102-
</div>
103-
)
104-
}
105-
{ enableEdit && <PrimaryButton text={'Edit'} type={'info'} submit link={`./edit`} /> }
93+
<div className={styles.title}>{challenge.name}</div>
94+
<div
95+
className={cn(
96+
styles.actionButtons,
97+
styles.button,
98+
styles.actionButtonsRight
99+
)}
100+
>
101+
{challenge.status === 'Draft' && (
102+
<div className={styles.button}>
103+
{challenge.legacyId || isTask ? (
104+
<PrimaryButton
105+
text={'Launch'}
106+
type={'info'}
107+
onClick={onLaunchChallenge}
108+
/>
109+
) : (
110+
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
111+
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
112+
<PrimaryButton text={'Launch'} type={'disabled'} />
113+
</Tooltip>
114+
)}
115+
</div>
116+
)}
117+
{isTask && challenge.status === 'Active' && (
118+
<div className={styles.button}>
119+
{assignedMemberDetails ? (
120+
<PrimaryButton
121+
text={'Close Task'}
122+
type={'danger'}
123+
onClick={onCloseTask}
124+
/>
125+
) : (
126+
<Tooltip content={MESSAGE.NO_TASK_ASSIGNEE}>
127+
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
128+
<PrimaryButton text={'Close Task'} type={'disabled'} />
129+
</Tooltip>
130+
)}
131+
</div>
132+
)}
133+
{enableEdit && (
134+
<PrimaryButton text={'Edit'} type={'info'} submit link={`./edit`} />
135+
)}
106136
<PrimaryButton text={'Back'} type={'info'} submit link={`..`} />
107137
</div>
108138
<div className={styles['challenge-view-selector']}>

0 commit comments

Comments
 (0)