diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 07b3dcf..fdb3e09 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}} @@ -102,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 c1ff775..c0b5733 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -137,8 +137,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] @@ -155,20 +155,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; } } @@ -213,7 +214,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 Date.parse(a.realDate) - Date.parse(b.realDate); + }); } Session.set("noclass", false); Session.set("calendarClasses", array); @@ -224,7 +227,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]]; } @@ -987,7 +990,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