<commit_before>var qs = require('qs');
var url = require('url');

module.exports = function(router, config) {
  
  router.all(config.routes.step, function(req,res, next){
    
    var requestedPage = req.params.step,
    postData = req.body || {};

    switch(requestedPage) {
      
      // kills the current session
      case 'kill_session': 
        req.session.destroy();
        return res.redirect('configure');
      break;
      // redirects the correct payment choice screen
      case 'change_payment':         
        if(postData['change_choice'] == 'increase') {
          return res.redirect('increase_value');
        } else {
          return res.redirect('reduce_value');
        }
      break;
      // this will create (or override) a session from querystring parameters
      // see the qs documentation here:
      // https://github.com/ljharb/qs/blob/master/README.md
      case 'create_session':         
        Object.assign(req.session.data,qs.parse(url.parse(req.url).query));
        return res.redirect('home');
      break;
      
      // this creates a session with particular data 
      case 'start_session':
        var debt_amount = 350;
        Object.assign(req.session.data,{
          username: "",
          password: "",
          debt_amount: debt_amount,
          payment_amount: parseFloat(Math.floor(debt_amount/100*10)).toFixed(2),
          payment_frequency: "fortnightly",
          debt_reason: ['is','pip']
        });
        return res.redirect('index');
      break;  
    }
    
    next();
  
  });

  return router;
}<commit_msg>corrected the percentage for the payment amount when it creates a session<commit_after>var qs = require('qs');
var url = require('url');

module.exports = function(router, config) {
  
  router.all(config.routes.step, function(req,res, next){
    
    var requestedPage = req.params.step,
    postData = req.body || {};

    switch(requestedPage) {
      
      // kills the current session
      case 'kill_session': 
        req.session.destroy();
        return res.redirect('configure');
      break;
      // redirects the correct payment choice screen
      case 'change_payment':         
        if(postData['change_choice'] == 'increase') {
          return res.redirect('increase_value');
        } else {
          return res.redirect('reduce_value');
        }
      break;
      // this will create (or override) a session from querystring parameters
      // see the qs documentation here:
      // https://github.com/ljharb/qs/blob/master/README.md
      case 'create_session':         
        Object.assign(req.session.data,qs.parse(url.parse(req.url).query));
        return res.redirect('home');
      break;
      
      // this creates a session with particular data 
      case 'start_session':
        var debt_amount = 350;
        Object.assign(req.session.data,{
          username: "",
          password: "",
          debt_amount: debt_amount,
          payment_amount: parseFloat(Math.floor(debt_amount/100*5)).toFixed(2),
          payment_frequency: "fortnightly",
          debt_reason: ['is','pip']
        });
        return res.redirect('index');
      break;  
    }
    
    next();
  
  });

  return router;
}
{'fraction_non_alphanumeric': 0.12596480395183698, 'fraction_numerical': 0.005248533497993208, 'mean_word_length': 2.188976377952756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7478575', 'n_tokens_mistral': 935, 'n_tokens_neox': 902, 'n_words': 201}