From 12be3f73f4d6f185a5f3357ece789b1217a1d423 Mon Sep 17 00:00:00 2001 From: John Cleaver Date: Sun, 3 Apr 2016 17:05:41 -0400 Subject: [PATCH 1/2] Added functions to calculate how many items are in a room. --- main.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.js b/main.js index 0574481..10fc5d6 100644 --- a/main.js +++ b/main.js @@ -116,6 +116,22 @@ var v = new Vue({ } } return ""; + }, + getRoomItemsRequired: function(roomId) { + return this.static.bundles.reduce(function(previousValue, nextValue){ + if(nextValue.room === roomId){ + return previousValue + nextValue.items_required; + } + else{ + return previousValue; + } + }, 0) + }, + getRoomItemsChecked: function(roomId){ + return this.static.bundles + .filter(function(b){ return b.room === roomId; }) + .map(function(b){ return b.id; }) + .reduce(function(p, c){ return p + v.user_data[c].length; }, 0); } } }); From 37382894f1266a51548f1940a3904e2f96484a82 Mon Sep 17 00:00:00 2001 From: John Cleaver Date: Sun, 3 Apr 2016 17:06:03 -0400 Subject: [PATCH 2/2] Added title and progress bar for room completion. --- index.html | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 7f7d200..7827aa9 100644 --- a/index.html +++ b/index.html @@ -141,9 +141,25 @@
-

{{ static.bundles[active_bundle].name }}

- +
+
+

{{ static.bundles[active_bundle].name }}

+
{{ static.bundles[active_bundle].reward }}
+ +
+
+

{{ static.rooms[static.bundles[active_bundle].room].name }}

+
{{ static.rooms[static.bundles[active_bundle].room].reward }}
+ + + +
+