diff --git a/w3/browser/components/SingleStudent.js b/w3/browser/components/SingleStudent.js index 695699b..2257aee 100644 --- a/w3/browser/components/SingleStudent.js +++ b/w3/browser/components/SingleStudent.js @@ -10,9 +10,11 @@ const avgGrade = tests => { const SingleStudent = (props) => { console.log('ppp', props) + const { tests } = props.student + const hasTests = tests.length ? true : false return (

{props.student.fullName}

-

Average grade: {avgGrade(props.student.tests)}%

+

Average grade: { hasTests && avgGrade(props.student.tests)}%

@@ -23,7 +25,7 @@ const SingleStudent = (props) => { { - props.student.tests.map((test) => { + hasTests && props.student.tests.map((test) => { return ( @@ -40,4 +42,4 @@ const SingleStudent = (props) => { } -export default SingleStudent \ No newline at end of file +export default SingleStudent
{test.subject}