From 9a304d63b489e6fe2a24c05d3bc8d9f36b7d15a6 Mon Sep 17 00:00:00 2001 From: rav4s Date: Thu, 21 Jan 2021 09:20:31 -0600 Subject: [PATCH] Added dashboard for most repairable devices --- Web_Dashboard/app.py | 59 ++++++++++- Web_Dashboard/templates/most-repairable.html | 103 +++++++++++++++++++ 2 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 Web_Dashboard/templates/most-repairable.html diff --git a/Web_Dashboard/app.py b/Web_Dashboard/app.py index 8ae1ba0..6926070 100644 --- a/Web_Dashboard/app.py +++ b/Web_Dashboard/app.py @@ -62,6 +62,63 @@ def index(): bad_laptop_3.append(message) return render_template('index.html', smartphone=bad_smartphone, tablet=bad_tablet, laptop=bad_laptop,smartphone_3=bad_smartphone_3, tablet_3=bad_tablet_3, laptop_3=bad_laptop_3, smartphone_2=bad_smartphone_2, tablet_2=bad_tablet_2, laptop_2=bad_laptop_2) -2 + +@app.route('/most-repairable') +def most_repairable(): + smartphone = [] + tablet = [] + laptop = [] + with open(smartphone_file, 'r', newline='') as file: + good_smartphone = [] + good_smartphone_2 = [] + good_smartphone_3 = [] + reader = csv.reader(file) + for row in reader: + smartphone.append(row) + if row[2] == '10': + message = row[0] + " " + row[1] + good_smartphone.append(message) + if row[2] == '9': + message = row[0] + " " + row[1] + good_smartphone_2.append(message) + if row[2] == '8': + message = row[0] + " " + row[1] + good_smartphone_3.append(message) + with open(tablet_file, 'r', newline='') as file: + good_tablet = [] + good_tablet_2 = [] + good_tablet_3 = [] + reader = csv.reader(file) + for row in reader: + tablet.append(row) + if row[2] == '10': + message = row[0] + " " + row[1] + good_tablet.append(message) + if row[2] == '9': + message = row[0] + " " + row[1] + good_tablet_2.append(message) + if row[2] == '8': + message = row[0] + " " + row[1] + good_tablet_3.append(message) + with open(laptop_file, 'r', newline='') as file: + good_laptop = [] + good_laptop_2 = [] + good_laptop_3 = [] + reader = csv.reader(file) + for row in reader: + laptop.append(row) + if row[2] == '10': + message = row[0] + " " + row[1] + good_laptop.append(message) + if row[2] == '9': + message = row[0] + " " + row[1] + good_laptop_2.append(message) + if row[2] == '8': + message = row[0] + " " + row[1] + good_laptop_3.append(message) + + return render_template('most-repairable.html', smartphone=good_smartphone, tablet=good_tablet, laptop=good_laptop,smartphone_3=good_smartphone_3, tablet_3=good_tablet_3, laptop_3=good_laptop_3, smartphone_2=good_smartphone_2, tablet_2=good_tablet_2, laptop_2=good_laptop_2) + + if __name__ == '__main__': app.run(host='0.0.0.0', port=1235) #Run the webserver2 diff --git a/Web_Dashboard/templates/most-repairable.html b/Web_Dashboard/templates/most-repairable.html new file mode 100644 index 0000000..b1d3e64 --- /dev/null +++ b/Web_Dashboard/templates/most-repairable.html @@ -0,0 +1,103 @@ + + + Most Repairable + + + + + + + + + +
+ Most Repairable +
+
+
+

Smartphones

+

10/10

+
+

+ {% for each in smartphone %} +

{{ each }}

+ {% endfor %} +

+
+

9/10

+
+

+ {% for each in smartphone_2 %} +

{{ each }}

+ {% endfor %} +

+
+

8/10

+
+

+ {% for each in smartphone_3 %} +

{{ each }}

+ {% endfor %} +

+
+
+
+

Tablets

+

10/10

+
+

+ {% for each in tablet %} +

{{ each }}

+ {% endfor %} +

+
+

9/10

+
+

+ {% for each in tablet_2 %} +

{{ each }}

+ {% endfor %} +

+
+

8/10

+
+

+ {% for each in tablet_3 %} +

{{ each }}

+ {% endfor %} +

+
+
+
+

Laptops

+

10/10

+
+

+ {% for each in laptop %} +

{{ each }}

+ {% endfor %} +

+
+

9/10

+
+

+ {% for each in laptop_2 %} +

{{ each }}

+ {% endfor %} +

+
+

8/10

+
+

+ {% for each in laptop_3 %} +

{{ each }}

+ {% endfor %} +

+
+
+
+
+

Made with ❤️ by Ravi Shah

+
+ +