fix(cert-settings): Provide defaults for falsey values
This commit is contained in:
committed by
mrugesh mohapatra
parent
c0b47ae7a7
commit
4a4fc0fa6e
@ -1,5 +1,5 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { kebabCase } from 'lodash';
|
import { kebabCase, defaultTo } from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button } from 'react-bootstrap';
|
import { Button } from 'react-bootstrap';
|
||||||
|
|
||||||
@ -61,6 +61,7 @@ class JSAlgoAndDSForm extends PureComponent {
|
|||||||
isCertClaimed
|
isCertClaimed
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const completeCount = Object.values(jsProjects)
|
const completeCount = Object.values(jsProjects)
|
||||||
|
.map(val => defaultTo(val, {}))
|
||||||
.filter(challengeInfo => Object.keys(challengeInfo).length !== 0)
|
.filter(challengeInfo => Object.keys(challengeInfo).length !== 0)
|
||||||
.length;
|
.length;
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ class JSAlgoAndDSForm extends PureComponent {
|
|||||||
<li className='solution-list-item'>
|
<li className='solution-list-item'>
|
||||||
<p>{ challenge }</p>
|
<p>{ challenge }</p>
|
||||||
{
|
{
|
||||||
Object.keys(jsProjects[challenge]).length ?
|
Object.keys(jsProjects[challenge] || {}).length ?
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
bsSize='lg'
|
bsSize='lg'
|
||||||
|
Reference in New Issue
Block a user