From 60dfa22485dfb8b27f8b47239fb6c69f9a36d150 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Fri, 16 Sep 2016 08:43:07 -0400 Subject: [PATCH 1/3] Sorts work by date --- hourglass/client/main/main.html | 15 +++++++-------- hourglass/client/main/main.js | 9 ++++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 07b3dcf..adefef2 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -32,8 +32,14 @@ {{#if myClasses}} +
+

Filters

+ {{#each types}} + {{> sideTypeFilter}} + {{/each}} +
-

Enrolled

+

By Class

{{#if calCreWork}}

-- Pick a class

{{else}} @@ -46,13 +52,6 @@ {{> sidebarClasses}} {{/each}}
- - -
-

Filters

- {{#each types}} - {{> sideTypeFilter}} - {{/each}}
{{/if}} diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 0d182cf..c22c844 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -136,8 +136,8 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective found.mine = false; } } - if (classDisp.indexOf(courses[i]) !== -1) found.selected = true; // Filter selected. - array.push(found); + if (classDisp.indexOf(courses[i]) !== -1) found.selected = true; // Filter selected. + array.push(found); var thisWork = work.find({ class: courses[i] @@ -176,6 +176,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective for (j = 0; j < thisWork.length; j++) { thisWork[j].classid = courses[i]; thisWork[j].realDate = thisWork[j].dueDate; + thisWork[j].numberDate = Date.parse(thisWork[j].realDate); thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, { sameDay: '[Today]', nextDay: '[Tomorrow]', @@ -212,7 +213,9 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective thisWork[j].doneRatio = "#FF1A1A"; } } - array[i].thisClassWork = thisWork; + array[i].thisClassWork = thisWork.sort(function(a, b) { + return parseFloat(a.numberDate) - parseFloat(b.numberDate); + }); } Session.set("noclass", false); Session.set("calendarClasses", array); From e627c449f13d440c6eaaf33345074c00dd009d48 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Fri, 16 Sep 2016 08:45:20 -0400 Subject: [PATCH 2/3] Removed extra field --- hourglass/client/main/main.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index c22c844..ec695ad 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -176,7 +176,6 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective for (j = 0; j < thisWork.length; j++) { thisWork[j].classid = courses[i]; thisWork[j].realDate = thisWork[j].dueDate; - thisWork[j].numberDate = Date.parse(thisWork[j].realDate); thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, { sameDay: '[Today]', nextDay: '[Tomorrow]', @@ -214,7 +213,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective } } array[i].thisClassWork = thisWork.sort(function(a, b) { - return parseFloat(a.numberDate) - parseFloat(b.numberDate); + return Date.parse(a.realDate) - Date.parse(b.realDate); }); } Session.set("noclass", false); From 46a3b7395a01847706a0cf52c05158df0b3cc481 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Fri, 16 Sep 2016 09:10:56 -0400 Subject: [PATCH 3/3] added hiding 'bad' (low ratio) work --- hourglass/client/main/main.html | 10 ++++++++++ hourglass/client/main/main.js | 12 +++++++----- hourglass/client/profile/profile.html | 11 +++++++++++ hourglass/client/profile/profile.js | 3 ++- hourglass/server/main.js | 3 ++- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index adefef2..fdb3e09 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -101,6 +101,16 @@

No

+
+
+

Hide Reported:

+ {{pref 'hideReport'}} +
+
+

Yes

+

No

+
+
diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index ec695ad..19b1b30 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -154,20 +154,21 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective var offset = (moment().subtract(hide, 'days'))._d; if (offset > due) { // If due is before hide days before today thisWork[j] = "no"; - j = 0; } } if (thisWork[j] !== "no" && Session.get("user").preferences.done) { // If done filter is true if (thisWork[j].done.indexOf(Meteor.userId()) !== -1) { // If user marked this work done. thisWork[j] = "no"; - j = 0; } } if (thisWork[j] !== "no" && sideFilter.length !== 0 && !_.contains(sideFilter, thisWork[j].type)) { + thisWork[j] = "no" + } + + if(thisWork[j] !== "no" && Session.get("user").preferences.hideReport && (thisWork[j].confirmations.length/thisWork[j].reports.length) <= 0.9) { thisWork[j] = "no"; - j = 0; } } @@ -225,7 +226,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective Template.registerHelper('pref', (val) => { // Obtains all user preferences. var preferences = Session.get("user").preferences; - if(val === 'timeHide' || val === 'done') { + if(val === 'timeHide' || val === 'done' || val == 'hideReport') { var invert = _.invert(ref); return invert[preferences[val]]; } @@ -988,7 +989,8 @@ function getPreferencesData() { // Get all data relating to preferences. "theme": document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(), "mode": document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(), "timeHide": ref[document.getElementById("prefHide").childNodes[0].nodeValue], - "done": ref[document.getElementById("prefDone").childNodes[0].nodeValue] + "done": ref[document.getElementById("prefDone").childNodes[0].nodeValue], + "hideReport": ref[document.getElementById("prefReport").childNodes[0].nodeValue] }; profile.preferences = options; return profile; diff --git a/hourglass/client/profile/profile.html b/hourglass/client/profile/profile.html index fc901ed..2668852 100644 --- a/hourglass/client/profile/profile.html +++ b/hourglass/client/profile/profile.html @@ -89,6 +89,17 @@

No

+
+
+
+

Hide Reported:

+ {{pref 'hideReport'}} +
+
+

Yes

+

No

+
+
diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index e9b6a39..5c5c41e 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -624,7 +624,8 @@ function getProfileData() { // Gets all data related to profile. "theme":document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(), "mode":document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(), "timeHide":ref[document.getElementById("prefHide").childNodes[0].nodeValue], - "done":ref[document.getElementById("prefDone").childNodes[0].nodeValue] + "done":ref[document.getElementById("prefDone").childNodes[0].nodeValue], + "hideReport":ref[document.getElementById("prefReport").childNodes[0].nodeValue] }; return profile; } diff --git a/hourglass/server/main.js b/hourglass/server/main.js index c1fad95..ec43cad 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -510,7 +510,8 @@ Meteor.methods({ "theme": "light", "mode": "classes", "timeHide": 1, - "done": true + "done": true, + "hideReport": true }; Meteor.users.update({ _id: userId