Commit 4b37eab6 authored by Curtis Adam's avatar Curtis Adam

Fix some functions using the wrong date

parent c2a3e1e3
......@@ -719,7 +719,7 @@ Template.registerHelper("getDate", function () {
if (Router.current().route.getName() === "welcome") {
date = Session.get('wordcloudItem')[10];
} else {
date = this.dateCreated;
date = this.date;
}
return moment(date).locale(Session.get('activeLanguage')).format('LL');
});
......@@ -757,7 +757,7 @@ Template.registerHelper("getDateUpdated", function () {
// Returns the locale date with time
Template.registerHelper("getTimestamp", function () {
return moment(this.dateCreated).locale(Session.get('activeLanguage')).format('LLLL');
return moment(this.date).locale(Session.get('activeLanguage')).format('LLLL');
});
// Returns all courses
......
......@@ -15,6 +15,6 @@ Template.cardsetInfoBoxItemPurchased.helpers({
return Paid.findOne({cardset_id: this._id}) !== undefined;
},
getDateOfPurchase: function () {
return moment(Paid.findOne({cardset_id: this._id}).dateCreated).locale(Session.get('activeLanguage')).format('LL');
return moment(Paid.findOne({cardset_id: this._id}).date).locale(Session.get('activeLanguage')).format('LL');
}
});
......@@ -15,6 +15,8 @@ let lastYear;
Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
getLectureDates: function (cardset) {
if (cardset.transcriptBonus !== undefined) {
lastMonth = undefined;
lastYear = undefined;
let results = [];
for (let i = 0; i < cardset.transcriptBonus.dates.length; i++) {
let item = JSON.parse(JSON.stringify(cardset.transcriptBonus));
......@@ -25,14 +27,14 @@ Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
}
},
isNewMonth: function (transcriptBonus) {
let currentMonth = moment(transcriptBonus.dateCreated).month();
let currentMonth = moment(transcriptBonus.date).month();
if (currentMonth !== lastMonth) {
lastMonth = currentMonth;
return true;
}
},
isNewYear: function (transcriptBonus) {
let currentYear = moment(transcriptBonus.dateCreated).year();
let currentYear = moment(transcriptBonus.date).year();
if (currentYear !== lastYear) {
lastYear = currentYear;
return true;
......@@ -48,7 +50,7 @@ Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
//returnMode 1 = Return tooltip
getStatus: function (transcriptBonus, returnMode = 0) {
let current = moment();
let lectureEndDate = TranscriptBonusList.addLectureEndTime(transcriptBonus, transcriptBonus.dateCreated);
let lectureEndDate = TranscriptBonusList.addLectureEndTime(transcriptBonus, transcriptBonus.date);
if (current > lectureEndDate && !TranscriptBonusList.isDeadlineExpired(transcriptBonus)) {
if (returnMode) {
return TAPi18n.__('transcriptForm.info.tooltip.lecture.active');
......@@ -70,8 +72,3 @@ Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
}
}
});
Template.cardsetInfoBoxItemTranscriptLectureDates.onCreated(function () {
lastMonth = undefined;
lastYear = undefined;
});
......@@ -12,7 +12,7 @@ Template.filterIndexItemBottomDeadline.helpers({
getBonusLectureDeadline: function () {
let bonusTranscript = TranscriptBonus.findOne({card_id: this._id});
if (bonusTranscript !== undefined) {
return TranscriptBonusList.getDeadlineEditing(bonusTranscript, bonusTranscript.dateCreated);
return TranscriptBonusList.getDeadlineEditing(bonusTranscript, bonusTranscript.date);
}
}
});
......@@ -19,7 +19,7 @@ Template.filterItemSortResults.helpers({
}
},
getSortCreatedDateIcon: function () {
switch (Filter.getActiveFilter().dateCreated) {
switch (Filter.getActiveFilter().date) {
case 1:
return '<i class="fa fa-sort-numeric-asc cards-filter-element"></i>';
case-1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment