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 { kebabCase } from 'lodash';
|
||||
import { kebabCase, defaultTo } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from 'react-bootstrap';
|
||||
|
||||
@ -61,6 +61,7 @@ class JSAlgoAndDSForm extends PureComponent {
|
||||
isCertClaimed
|
||||
} = this.props;
|
||||
const completeCount = Object.values(jsProjects)
|
||||
.map(val => defaultTo(val, {}))
|
||||
.filter(challengeInfo => Object.keys(challengeInfo).length !== 0)
|
||||
.length;
|
||||
|
||||
@ -78,7 +79,7 @@ class JSAlgoAndDSForm extends PureComponent {
|
||||
<li className='solution-list-item'>
|
||||
<p>{ challenge }</p>
|
||||
{
|
||||
Object.keys(jsProjects[challenge]).length ?
|
||||
Object.keys(jsProjects[challenge] || {}).length ?
|
||||
<div>
|
||||
<Button
|
||||
bsSize='lg'
|
||||
|
Reference in New Issue
Block a user