Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions w4/browser/components/NewStudentForm.js

This file was deleted.

9 changes: 6 additions & 3 deletions w4/browser/components/SingleStudent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const avgGrade = tests => {

const SingleStudent = (props) => {
console.log('ppp', props)
const { tests } = props.student
const hasTests = tests.length ? true : false

return ( <div>
<h3>{props.student.fullName}</h3>
<h3>Average grade: {avgGrade(props.student.tests)}%</h3>
<h3>Average grade: {hasTests && avgGrade(props.student.tests)}%</h3>
<div>
<table>
<thead>
Expand All @@ -23,7 +26,7 @@ const SingleStudent = (props) => {
</thead>
<tbody>
{
props.student.tests.map((test) => {
hasTests && props.student.tests.map((test) => {
return (
<tr key={test.id}>
<td>{test.subject}</td>
Expand All @@ -40,4 +43,4 @@ const SingleStudent = (props) => {
}


export default SingleStudent
export default SingleStudent