Sorts work by date

This commit is contained in:
Kenneth Jao 2016-09-16 08:43:07 -04:00
parent 415a621f6c
commit 60dfa22485
2 changed files with 13 additions and 11 deletions

View File

@ -32,8 +32,14 @@
</div>
</div>
{{#if myClasses}}
<div id="classFilterHolder">
<h3>Filters</h3>
{{#each types}}
{{> sideTypeFilter}}
{{/each}}
</div>
<div id="classListHolder">
<h3>Enrolled</h3>
<h3>By Class </h3>
{{#if calCreWork}}
<h3 id="calCreWork">-- Pick a class</h3>
{{else}}
@ -46,13 +52,6 @@
{{> sidebarClasses}}
{{/each}}
</div>
</div>
<div id="classFilterHolder">
<h3>Filters</h3>
{{#each types}}
{{> sideTypeFilter}}
{{/each}}
</div>
{{/if}}
</div>

View File

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