<commit_before>'use strict';

var _ = require('lodash');
var moment = require('moment');
var Article = require('../../models/Article');
var articleService = require('../../services/article');
var cryptoService = require('../../services/crypto');
var longDate = 'dddd Do, MMMM YYYY [at] HH:mm';

module.exports = getModel;

function getModel (req, res, next) {
  Article.find({}).sort('-created').exec(respond);

  function respond (err, articles) {
    if (err) {
      next(err); return;
    }
    var hydrated = articles.map(articleService.toJSON).map(hydrate);
    var sorted = _.sortBy(hydrated, sortByStatus);
    res.viewModel = {
      model: {
        title: 'Article Review',
        meta: {
          canonical: '/author/review'
        },
        articles: sorted
      }
    };
    next();
  }<commit_msg>sort articles correctly in review page<commit_after>'use strict';

var _ = require('lodash');
var moment = require('moment');
var Article = require('../../models/Article');
var articleService = require('../../services/article');
var cryptoService = require('../../services/crypto');
var longDate = 'dddd Do, MMMM YYYY [at] HH:mm';

module.exports = getModel;

function getModel (req, res, next) {
  Article.find({}).sort('-publication').exec(respond);

  function respond (err, articles) {
    if (err) {
      next(err); return;
    }
    var hydrated = articles.map(articleService.toJSON).map(hydrate);
    var sorted = _.sortBy(hydrated, sortByStatus);
    res.viewModel = {
      model: {
        title: 'Article Review',
        meta: {
          canonical: '/author/review'
        },
        articles: sorted
      }
    };
    next();
  }
{'fraction_non_alphanumeric': 0.16957306073361395, 'fraction_numerical': 0.0, 'mean_word_length': 2.9061032863849765, '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': '3074236', 'n_tokens_mistral': 515, 'n_tokens_neox': 497, 'n_words': 121}