Skip to content

Commit

Permalink
Added checks for empty descriptions in DataDescription component
Browse files Browse the repository at this point in the history
  • Loading branch information
pushpanjalip committed Jan 7, 2020
1 parent 0a3eb90 commit 776bf5c
Showing 1 changed file with 37 additions and 32 deletions.
69 changes: 37 additions & 32 deletions src/components/DataDescription/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const DataDescription = (props: IProps) => {
);

if (data) {
if (data.participant_data_files.length > 0) {
if (data.participant_data_files.length > 0
|| data.participant_data_description !== ''
|| data.participant_data_sampling_method !== ''
) {
content.push(
(
<Grid item={true} key={3} xs={12} sm={6} md={6}>
Expand All @@ -43,42 +46,44 @@ const DataDescription = (props: IProps) => {
),
);
}
if (data.public_test_data_file && publicLbData.push(data.public_test_data_file),
data.public_ground_truth_data_file && publicLbData.push(data.public_ground_truth_data_file)) {
content.push(
(
<Grid item={true} key={1} xs={12} sm={6} md={6}>
<DataFileCard
dataFiles={[]}
type={'Public Leaderboard Data'}
desc={data.public_test_data_description}
sampling={data.public_test_data_sampling_method}
/>
</Grid>
),
);
if (data.public_test_data_description !== '' || data.public_test_data_sampling_method !== '') {
if (data.public_test_data_file && publicLbData.push(data.public_test_data_file),
data.public_ground_truth_data_file && publicLbData.push(data.public_ground_truth_data_file)) {
content.push(
(
<Grid item={true} key={1} xs={12} sm={6} md={6}>
<DataFileCard
dataFiles={[]}
type={'Public Leaderboard Data'}
desc={data.public_test_data_description}
sampling={data.public_test_data_sampling_method}
/>
</Grid>
),
);
}
}
if (data.private_test_data_file && privateLbData.push(data.private_test_data_file),
data.private_ground_truth_data_file && privateLbData.push(data.private_ground_truth_data_file)) {
content.push(
(
<Grid item={true} key={2} xs={12} sm={6} md={6}>
<DataFileCard
dataFiles={[]}
type={'Private Leaderboard Data'}
desc={data.private_test_data_description}
sampling={data.private_test_data_sampling_method}
/>
</Grid>
),
);
if (data.private_test_data_description !== '' || data.private_test_data_sampling_method !== '') {
if (data.private_test_data_file && privateLbData.push(data.private_test_data_file),
data.private_ground_truth_data_file && privateLbData.push(data.private_ground_truth_data_file)) {
content.push(
(
<Grid item={true} key={2} xs={12} sm={6} md={6}>
<DataFileCard
dataFiles={[]}
type={'Private Leaderboard Data'}
desc={data.private_test_data_description}
sampling={data.private_test_data_sampling_method}
/>
</Grid>
),
);
}
}

}
return (
<Grid container={true} spacing={10}>
{content.length > 0 ? content : null}
</Grid>
content.length > 0 ? <Grid container={true} spacing={10}>{content}</Grid> : null
);

};
Expand Down

0 comments on commit 776bf5c

Please sign in to comment.