<commit_before>const models = require('../models');

const failureCtrl = module.exports = {};

failureCtrl.new = function (req, res) {
  models.Failure.create(req.body)
    .then(function () {
      res.redirect('/readAll');
    });
};

failureCtrl.list = function (req, res) {
  models.Failure.findAll()
    .then(function (failures) {
      res.render('failures', {
        brand: 'Muddles',
        title: 'readAll',
        subtitle: 'The list of the things that suck.',
        failures,
      });
    });
};

failureCtrl.read = function (req, res) {
  models.Failure.findOne({
    where: { id: req.params.failureId }
  })
    .then(function (failure) {
      res.render('failure', {
        brand: 'Muddles',
        title: 'readOne',
        subtitle: 'The one of the things that suck.',
        failure,
      });
    });
};<commit_msg>sort all failures on desc createdAt order<commit_after>const models = require('../models');

const failureCtrl = module.exports = {};

failureCtrl.new = function (req, res) {
  models.Failure.create(req.body)
    .then(function () {
      res.redirect('/readAll');
    });
};

failureCtrl.list = function (req, res) {
  models.Failure.findAll({
    order: [['createdAt', 'DESC']]
  })
    .then(function (failures) {
      res.render('failures', {
        brand: 'Muddles',
        title: 'readAll',
        subtitle: 'The list of the things that suck.',
        failures,
      });
    });
};

failureCtrl.read = function (req, res) {
  models.Failure.findOne({
    where: { id: req.params.failureId }
  })
    .then(function (failure) {
      res.render('failure', {
        brand: 'Muddles',
        title: 'readOne',
        subtitle: 'The one of the things that suck.',
        failure,
      });
    });
};
{'fraction_non_alphanumeric': 0.1662870159453303, 'fraction_numerical': 0.0, 'mean_word_length': 2.493041749502982, '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': '6590670', 'n_tokens_mistral': 552, 'n_tokens_neox': 553, 'n_words': 125}