diff options
author | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2023-04-26 19:27:01 -0400 |
---|---|---|
committer | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2023-04-26 19:27:01 -0400 |
commit | b7f1995778f2982c81e85111f76fa0bf8fb71ee8 (patch) | |
tree | 7895be35c1a89fc8f5db0cf336788106dba60fa9 /part1/unicafe/src | |
parent | 0d8830d0a55a2ee50ba9d78673896abb4d920952 (diff) |
ex1.9 display statistics only once feedback is gathered
Diffstat (limited to 'part1/unicafe/src')
-rw-r--r-- | part1/unicafe/src/App.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/part1/unicafe/src/App.js b/part1/unicafe/src/App.js index 4210f9c..b583060 100644 --- a/part1/unicafe/src/App.js +++ b/part1/unicafe/src/App.js @@ -18,8 +18,10 @@ const Statistics = (props) => { const good = props.good const bad = props.bad const neutral = props.neutral + if (good === 0 && bad === 0 && neutral === 0) { + return <p>No feedback given</p> + } const total = good + neutral + bad - const average = (good - bad) / 9.0 const positive_percent = (good/total) * 100 return ( |