<commit_before>'use strict';

var config = require('../config')
  , render = require('../lib').render
  , models = require('../models')
  , moment = require('moment')
  ;

module.exports.init = function(app) {
  app.get('/', getHome);
  app.get('/portfolio', getPortfolio);
  app.get('/projects', getProjects);
  app.get('/about', getAbout);
};

function getHome(req, res) {
  var locals = {};

  models.Track.findOne({}, 'scrobbleDate href imageSrc', {
    sort: {
      scrobbleDate: -1
    }
  }, function(err, track) {
    models.Image.findOne({}, 'postDate href src', {
      sort: {
        postDate: -1
      }
    }, function(err, image) {
        locals.footerContent = {};

        if (track) {
          track.date_formatted = moment(track.scrobbleDate).fromNow();
          locals.footerContent.track = track;
        }

        if (image) {
          image.date_formatted = moment(image.postDate).fromNow();
          locals.footerContent.image = image;
        }

        // temporary hard coded movie
        locals.footerContent.movie = {
          href: 'http://www.amazon.com/Entourage-Complete-Eighth-Final-Season/dp/B0058YPQ0C',
          src: 'http://ecx.images-amazon.com/images/I/41wejPs307L._SY300_.jpg'
        };

        locals.showMastHead = true;
        locals.showFooterMedia = true;

        render(res, 'home', locals);
      });
  });
}

function getPortfolio(req, res) {
  res.redirect(301, '/projects');
}

function getProjects(req, res) {
  render(res, 'projects', {
    pageTitle: 'Projects'
  });
}

function getAbout(req, res) {
  render(res, 'about', {
    pageTitle: 'About William Youmans'
  });
}<commit_msg>fixed about page browser title<commit_after>'use strict';

var config = require('../config')
  , render = require('../lib').render
  , models = require('../models')
  , moment = require('moment')
  ;

module.exports.init = function(app) {
  app.get('/', getHome);
  app.get('/portfolio', getPortfolio);
  app.get('/projects', getProjects);
  app.get('/about', getAbout);
};

function getHome(req, res) {
  var locals = {};

  models.Track.findOne({}, 'scrobbleDate href imageSrc', {
    sort: {
      scrobbleDate: -1
    }
  }, function(err, track) {
    models.Image.findOne({}, 'postDate href src', {
      sort: {
        postDate: -1
      }
    }, function(err, image) {
        locals.footerContent = {};

        if (track) {
          track.date_formatted = moment(track.scrobbleDate).fromNow();
          locals.footerContent.track = track;
        }

        if (image) {
          image.date_formatted = moment(image.postDate).fromNow();
          locals.footerContent.image = image;
        }

        // temporary hard coded movie
        locals.footerContent.movie = {
          href: 'http://www.amazon.com/Entourage-Complete-Eighth-Final-Season/dp/B0058YPQ0C',
          src: 'http://ecx.images-amazon.com/images/I/41wejPs307L._SY300_.jpg'
        };

        locals.showMastHead = true;
        locals.showFooterMedia = true;

        render(res, 'home', locals);
      });
  });
}

function getPortfolio(req, res) {
  res.redirect(301, '/projects');
}

function getProjects(req, res) {
  render(res, 'projects', {
    pageTitle: 'Projects'
  });
}

function getAbout(req, res) {
  render(res, 'about', {
    pageTitle: 'About'
  });
}
{'fraction_non_alphanumeric': 0.16580937972768534, 'fraction_numerical': 0.010892586989409985, 'mean_word_length': 2.5663430420711975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2055932', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1086, 'n_words': 190}