From b7f1995778f2982c81e85111f76fa0bf8fb71ee8 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Wed, 26 Apr 2023 19:27:01 -0400 Subject: ex1.9 display statistics only once feedback is gathered --- part1/unicafe/src/App.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'part1/unicafe/src') 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

No feedback given

+ } const total = good + neutral + bad - const average = (good - bad) / 9.0 const positive_percent = (good/total) * 100 return ( -- cgit v1.2.3