aboutsummaryrefslogtreecommitdiff
path: root/part1
diff options
context:
space:
mode:
authorIbrahim Mkusa <ibrahimmkusa@gmail.com>2023-04-26 19:27:01 -0400
committerIbrahim Mkusa <ibrahimmkusa@gmail.com>2023-04-26 19:27:01 -0400
commitb7f1995778f2982c81e85111f76fa0bf8fb71ee8 (patch)
tree7895be35c1a89fc8f5db0cf336788106dba60fa9 /part1
parent0d8830d0a55a2ee50ba9d78673896abb4d920952 (diff)
ex1.9 display statistics only once feedback is gathered
Diffstat (limited to 'part1')
-rw-r--r--part1/unicafe/src/App.js4
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 (