added hiding 'bad' (low ratio) work

This commit is contained in:
Kenneth Jao 2016-09-16 09:10:56 -04:00
parent e627c449f1
commit 46a3b7395a
5 changed files with 32 additions and 7 deletions

View File

@ -101,6 +101,16 @@
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
<div>
<div class="inputRadioPref">
<p class="prefTitle">Hide Reported:</p>
<span class="change radio" re="readonly" id="prefReport">{{pref 'hideReport'}}</span>
</div>
<div class="prefOptions">
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">Yes</p>
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
</div>
</div>
<img id="bg" src={{bgSrc}} style="min-width:{{screen}}">

View File

@ -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;

View File

@ -89,6 +89,17 @@
<p class="profOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
<br>
<div class="radioContainer">
<div class="inputRadio">
<p class="profTitle">Hide Reported:</p>
<span class="change radio" re="readonly" id="prefReport">{{pref 'hideReport'}}</span>
</div>
<div class="profOptions">
<p class="profOptionText" style="background-color:{{divColor 'header'}}">Yes</p>
<p class="profOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
</div>
</div>
</div>

View File

@ -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;
}

View File

@ -510,7 +510,8 @@ Meteor.methods({
"theme": "light",
"mode": "classes",
"timeHide": 1,
"done": true
"done": true,
"hideReport": true
};
Meteor.users.update({
_id: userId