<commit_before>"use strict";

Router.map(function () {
	this.route('showEvent', {
		path: 'event/:_id',
		template: 'eventPage',
		waitOn: function () {
			return [
				Meteor.subscribe('categories'),
				Meteor.subscribe('events')
			]
		},
		data: function () {
			
			var event;
			var create = 'create' == this.params._id;
			if (create) {
				var propose = moment().add(1, 'week').startOf('hour');
				event = {
					new: true,
					startdate: propose.toDate(),
					enddate: moment(propose).add(2, 'hour').toDate()
				};
			} else {
				event = Events.findOne({_id: this.params._id});
				if (!event) return {};
			}

			return event;
		}
	})
});


Template.event.created = function() {
	this.editing = new ReactiveVar(false);
}

Template.eventPage.helpers({
	course: function() {
		console.log(this)
		var courseId = this.course_id;
		if (courseId) {
			// Very bad?
			Template.instance().subscribe('courseDetails', courseId);
			
			return Courses.findOne({_id: courseId});
		}
	}
});

Template.event.helpers({
	editing: function() {
		return this.new || Template.instance().editing.get();
	}
});<commit_msg>remove blanket subscription to events #53<commit_after>"use strict";

Router.map(function () {
	this.route('showEvent', {
		path: 'event/:_id',
		template: 'eventPage',
		waitOn: function () {
			return [
				Meteor.subscribe('categories'),
				Meteor.subscribe('event', this.params._id)
			]
		},
		data: function () {
			
			var event;
			var create = 'create' == this.params._id;
			if (create) {
				var propose = moment().add(1, 'week').startOf('hour');
				event = {
					new: true,
					startdate: propose.toDate(),
					enddate: moment(propose).add(2, 'hour').toDate()
				};
			} else {
				event = Events.findOne({_id: this.params._id});
				if (!event) return {};
			}

			return event;
		}
	})
});


Template.event.created = function() {
	this.editing = new ReactiveVar(false);
}

Template.eventPage.helpers({
	course: function() {
		var courseId = this.course_id;
		if (courseId) {
			// Very bad?
			Template.instance().subscribe('courseDetails', courseId);
			
			return Courses.findOne({_id: courseId});
		}
	}
});

Template.event.helpers({
	editing: function() {
		return this.new || Template.instance().editing.get();
	}
});
{'fraction_non_alphanumeric': 0.18008849557522125, 'fraction_numerical': 0.002654867256637168, 'mean_word_length': 3.2741020793950852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4501007', 'n_tokens_mistral': 919, 'n_tokens_neox': 770, 'n_words': 147}