refactor: destructure some objects in list map iterate
This commit is contained in:
parent
0cd2580957
commit
f232ad62b5
@ -17,7 +17,7 @@ const _renderSubmissions = (pageNr, submissions) => {
|
||||
if (submissions) {
|
||||
return (
|
||||
<FlexColumn as='tbody' width='100%'>
|
||||
{submissions.slice(n, n + ELEMENTS_PER_PAGE).map((submission, index) => {
|
||||
{submissions.slice(n, n + ELEMENTS_PER_PAGE).map(({submitter, when, evaluations, version}, index) => {
|
||||
return (
|
||||
<Grid as='tr' key={`leaderboard-row-${index}`} gridTemplateColumns='1fr 3fr 3fr 1fr 1fr'
|
||||
gridGap='10px' margin='10px 0 0 0' position='relative' width='100%'>
|
||||
@ -25,17 +25,17 @@ const _renderSubmissions = (pageNr, submissions) => {
|
||||
{index + n + 1}
|
||||
</Body>
|
||||
<Body as='td'>
|
||||
{submission.submitter ? submission.submitter : '[anonymous]'}
|
||||
{submitter ? submitter : '[anonymous]'}
|
||||
</Body>
|
||||
<Body as='td'>
|
||||
{submission.when ? `${submission.when.slice(11, 16)} ${submission.when.slice(0, 10)}`
|
||||
{when ? `${when.slice(11, 16)} ${when.slice(0, 10)}`
|
||||
: 'xxx'}
|
||||
</Body>
|
||||
<Body as='td'>
|
||||
{submission.evaluations[0] ? submission.evaluations[0].score : 'xxx'}
|
||||
{evaluations[0] ? evaluations[0].score : 'xxx'}
|
||||
</Body>
|
||||
<Body as='td' textAlign='right' padding='0 2px 0 0'>
|
||||
{submission.version ? submission.version.length : 1}
|
||||
{version ? version.length : 1}
|
||||
</Body>
|
||||
<Line as='td'/>
|
||||
</Grid>
|
||||
|
@ -23,13 +23,12 @@ const _renderChallenges = (pageNr, challenges) => {
|
||||
if (challenges && challenges !== []) {
|
||||
return (
|
||||
<ChallengesGrid margin='32px 0' gridGap='32px 0'>
|
||||
{challenges.slice(n, n + ELEMENTS_PER_PAGE).map((challenge, index) => {
|
||||
{challenges.slice(n, n + ELEMENTS_PER_PAGE).map(
|
||||
({title, type, description, mainMetric, bestScore, baseline, prize, deadline, name}, index) => {
|
||||
return (
|
||||
<MiniChallenge key={`challenge-${index}`} title={challenge.title} type={challenge.type}
|
||||
description={challenge.description} metric={challenge.mainMetric}
|
||||
bestScore={challenge.bestScore} baseline={challenge.baseline}
|
||||
prize={challenge.prize} deadline={challenge.deadline}
|
||||
name={challenge.name}/>
|
||||
<MiniChallenge key={`challenge-${index}`} title={title} type={type}
|
||||
description={description} metric={mainMetric} bestScore={bestScore}
|
||||
baseline={baseline} prize={prize} deadline={deadline} name={name}/>
|
||||
);
|
||||
})}
|
||||
</ChallengesGrid>
|
||||
|
Loading…
Reference in New Issue
Block a user