Add composite score to table export
authorJakob Cornell <jakob@jcornell.net>
Tue, 7 Jan 2020 02:31:04 +0000 (20:31 -0600)
committerJakob Cornell <jakob@jcornell.net>
Tue, 7 Jan 2020 02:31:04 +0000 (20:31 -0600)
main.py

diff --git a/main.py b/main.py
index 389a781d2300bc940af4fdddabb73b3288bdef3f..96f22b69c14c08d5747d19a62f6ae38801aae957 100644 (file)
--- a/main.py
+++ b/main.py
@@ -274,7 +274,13 @@ class MainView(View):
 
                def on_gen_table():
                        name = self.controller.state['student']
-                       rows = [DataEditModel.Record.DISPLAY_NAMES] + self.controller.data[name]
+                       head = list(DataEditModel.Record.DISPLAY_NAMES)
+                       head.insert(5, "Score (Comp)")
+                       def with_composite(record):
+                               new = list(record)
+                               new.insert(5, round(record.overall_score(), 1))
+                               return new
+                       rows = [head] + list(map(with_composite, self.controller.data[name]))
                        data = json.dumps(rows).encode('utf-8')
                        server = AsyncHttpServer(57853, data)
                        server.start()