{"size": 779, "ext": "js", "max_stars_repo_path": "routes/views/event.js", "max_stars_repo_name": "kevin-roark/hifi-snock-uptown", "max_stars_repo_stars_event_min_datetime": "2015-01-26T05:31:43.000Z", "max_stars_repo_stars_event_max_datetime": "2015-01-26T05:31:43.000Z", "max_issues_repo_path": "routes/views/event.js", "max_issues_repo_name": "kevin-roark/hifi-snock-uptown", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routes/views/event.js", "max_forks_repo_name": "kevin-roark/hifi-snock-uptown", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.8518518519, "max_line_length": 57, "alphanum_fraction": 0.4146341463}
var keystone = require('keystone');
var Event = keystone.list('Event');
 
exports = module.exports = function(req, res) {
    var view = new keystone.View(req, res);
    Event.model.findOne()
        .where('slug', req.params.slug)
        .exec(function(err, ev) {
            if (err) {
                console.log(err);
                return;
            }

            Event.model.find()
                .where('slug').ne(req.params.slug)
                .sort('-startTime')
                .exec(function(err, evs) {
                    if (err) {
                        console.log(err);
                        return;
                    }

                    evs.unshift(ev);
                    view.render('events', {events: evs});
                });
        });
}