<commit_before>/*eslint max-nested-callbacks: [2, 4], complexity: [2, 20]*/
var config = require('../config/config.js');

var routesUtilities = require('../utilities/routes.js');

var ad = config.ad;
var serviceConfig = config.service;
var ldapClient = require('../lib/ldap-client');

var fs = require('fs');
var auth = require('../lib/auth');
var authConfig = config.auth;
var mongoose = require('mongoose');
var path = require('path');
var underscore = require('underscore');
var cheer = require('cheerio');
var reqUtils = require('../lib/req-utils');
var shareLib = require('../lib/share');

var Form = mongoose.model('Form');
var User = mongoose.model('User');
var Group = mongoose.model('Group');
var Traveler = mongoose.model('Traveler');
var TravelerData = mongoose.model('TravelerData');
var TravelerNote = mongoose.model('TravelerNote');

// var request = require('request');

function createTraveler(form, req, res) {
  // update the total input number and finished input number
  var $ = cheer.load(form.html);
  var num = $('input, textarea').length;<commit_msg>Resolve the issues with total input count to group inputs of the same name.<commit_after>/*eslint max-nested-callbacks: [2, 4], complexity: [2, 20]*/
var config = require('../config/config.js');

var routesUtilities = require('../utilities/routes.js');

var ad = config.ad;
var serviceConfig = config.service;
var ldapClient = require('../lib/ldap-client');

var fs = require('fs');
var auth = require('../lib/auth');
var authConfig = config.auth;
var mongoose = require('mongoose');
var path = require('path');
var underscore = require('underscore');
var cheer = require('cheerio');
var reqUtils = require('../lib/req-utils');
var shareLib = require('../lib/share');

var Form = mongoose.model('Form');
var User = mongoose.model('User');
var Group = mongoose.model('Group');
var Traveler = mongoose.model('Traveler');
var TravelerData = mongoose.model('TravelerData');
var TravelerNote = mongoose.model('TravelerNote');

// var request = require('request');

function createTraveler(form, req, res) {
  // update the total input number and finished input number
  var $ = cheer.load(form.html);
  var inputs = $('input, textarea');
  var num = 0;
  // Determine accurate number of inputs. Radio buttons consist of many inputs but represent one.
  var last_input_name = "";
  for (var i = 0; i < inputs.length; i++) {
    var input = inputs[i];
    var input_name = input.attribs['name'];
    if (last_input_name === input_name) {
      continue;
    }
    last_input_name = input_name;
    num++;
  }

{'fraction_non_alphanumeric': 0.16809006211180125, 'fraction_numerical': 0.004658385093167702, 'mean_word_length': 4.553879310344827, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4695374', 'n_tokens_mistral': 805, 'n_tokens_neox': 803, 'n_words': 229}