<commit_before>require('./../lib/ejs-filters');

var transaction,
    crypto = require('crypto'),
    EPDQ = require('epdq'),
    Transaction = require('./../models/transaction');

var journeyDescription = function(step){
  return transaction.slug + ":" + step;
};

// Middleware filter.
var findTransaction = function(req, res, next){
  try {
    var name = null;
    if (req.subdomains.length){
      name = req.subdomains[req.subdomains.length - 1];
    }
    transaction = Transaction.find(name);
  } catch(err) {
    res.status(404);
    res.send('404 error');
    return;
  }
  next();
};
var setExpiry = function(req, res, next){
  res.setHeader('Cache-Control', 'max-age=1800, public');
  next();
};

var secureRandom = function(len){
  return crypto.randomBytes(len).toString('hex');;
};

var transactionDoneUrl = function(req){
  return req.protocol + "://" + req.host + "/done";
};
var epdqTemplateUrl = function(req){
  return "TODO";
};


var paramplusValue = function(params){
  var vals = [];
  Transaction.PARAMPLUS_KEYS.forEach(function(key){
    if (typeof params['transaction'][key] != 'undefined'){
      vals.push(key + "=" + params['transaction'][key]);
    }
  });
  return vals;
};
<commit_msg>Hardwire template url for now<commit_after>require('./../lib/ejs-filters');

var transaction,
    crypto = require('crypto'),
    EPDQ = require('epdq'),
    Transaction = require('./../models/transaction');

var journeyDescription = function(step){
  return transaction.slug + ":" + step;
};

// Middleware filter.
var findTransaction = function(req, res, next){
  try {
    var name = null;
    if (req.subdomains.length){
      name = req.subdomains[req.subdomains.length - 1];
    }
    transaction = Transaction.find(name);
  } catch(err) {
    res.status(404);
    res.send('404 error');
    return;
  }
  next();
};
var setExpiry = function(req, res, next){
  res.setHeader('Cache-Control', 'max-age=1800, public');
  next();
};

var secureRandom = function(len){
  return crypto.randomBytes(len).toString('hex');;
};

var websiteRoot = function(req){
  return req.protocol + "://" + req.host;
}

var transactionDoneUrl = function(req){
  return websiteRoot(req) + "/done";
};
var epdqTemplateUrl = function(req){
  //return websiteRoot(req) + "/barclays_epdq_template.html";
  return "https://assets.digital.cabinet-office.gov.uk/templates/barclays_epdq.html";
};


var paramplusValue = function(params){
  var vals = [];
  Transaction.PARAMPLUS_KEYS.forEach(function(key){
    if (typeof params['transaction'][key] != 'undefined'){
      vals.push(key + "=" + params['transaction'][key]);
    }
  });
  return vals;
};

{'fraction_non_alphanumeric': 0.17951625094482238, 'fraction_numerical': 0.008314436885865457, 'mean_word_length': 3.856880733944954, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '295160', 'n_tokens_mistral': 889, 'n_tokens_neox': 858, 'n_words': 170}