<commit_before>const debug = require('debug')('app:script');
const knex = require('knex');
const _ = require('lodash');
const config = require('../config/ilmomasiina.config.js');

const db = knex({
  client: 'mysql',
  connection: {
    user: config.mysqlUser,
    password: <PASSWORD>,
    database: config.mysqlDatabase,
  },
});

const events = [
  {
    title: 'Minuuttikalja 2016',
    date: '2016-04-28 18:00:00',
    description: 'Legendaarinen wappufiiliksen pikakohottaja, Minuuttikalja',
    price: '',
    location: 'Smökki (Jämeräntaival 4, Espoo)',
    homepage: '',
    facebooklink: 'https://www.facebook.com/events/1715883881987829/',
  },
  {
    title: 'Columbia Road -excu',
    date: '2017-1-11 17:00:00',
    description: 'Tapahtuma, jossa kiintiöt aukeavat eri aikoihin. Columbia Road toivottaa athenelaiset ja tikkiläiset\n\nMonen rivin kuvaus\n\nlorem dorem', // eslint-disable-line
    price: '0 €',
    location: 'Eerikinkatu 5, Helsinki',
    homepage: 'http://crexcu2017.wordpress.com/',
    facebooklink: '',
  },
  {
    title: 'Ystävänpäiväsitsit',
    date: '2017-2-14 18:30:00',
    description: 'Sitsit kiintiöillä',
    price: '14 € (12 € alkoholiton)',
    location: 'Smökki',
    homepage: 'http://crexcu2017.wordpress.com/',
    facebooklink: '',
  },
  {
    title: 'Athene Alumni',
    description: 'Lorem ipsum. Lomake kaikilla kentillä.',
    facebooklink: 'https://www.facebook.com/events/1715883881987829/',
  },
];

const quotas = [
  {
    eventId: 1,
    title: 'Minuuttikalja 2016',
    going: 18,
    size: 20,
    signupOpens: '2016-4-15 17:00:00',
    signupCloses: '2017-4-29 17:00:00',
  },
  {
    eventId: 2,
    title: 'Athene',
    going: 0,
    size: 20,
    signupOpens: '2017-1-10 17:00:00',
    signupCloses: '2017-1-11 17:00:00',
  },
  {
    eventId: 2,
    title: 'Tietokilta',
    going: 19,
    size: 20,
    signupOpens: '2017-1-1 17:00:00',
    signupCloses: '2017-1-8 17:00:00',
  },
  {
    eventId: 3,
    title: 'Athene',
    going: 2,
    size: 20,
    signupOpens: '2017-1-11 17:00:00',
    signupCloses: '2017-1-11 17:00:00',
  },
  {
    eventId: 3,
    title: 'Prodeko',
    going: 15,
    size: 20,
    signupOpens: '2017-1-11 17:00:00',
    signupCloses: '2017-1-11 17:00:00',
  },
  {
    eventId: 3,
    title: 'Tietokilta',
    going: 20,
    size: 20,
    signupOpens: '2017-1-11 17:00:00',
    signupCloses: '2017-1-11 17:00:00',
  },
  {
    eventId: 4,
    title: 'Athene Alumni',
    going: 5,
  },
];

const questions = [
  {
    id: 1,
    eventId: 3,
    type: 'text',
    question: 'Pöytätoive',
    required: true,
    public: false,
  },
  {
    id: 2,
    eventId: 4,
    type: 'text',
    question: 'Valmistumisvuosi',
    required: true,
    public: false,
  },
  {
    id: 3,
    eventId: 4,
    type: 'textarea',
    question: 'Terveiset',
    required: true,
    public: true,
  },
  {
    id: 4,
    eventId: 4,
    type: 'select',
    question: 'Monivalinta',
    options: 'Vaihtoehto 1,Vaihtoehto 2,Vaihtoehto 3',
    required: true,
    public: true,
  },
  {
    id: 5,
    eventId: 3,
    type: 'checkbox',
    question: 'Valintaruudut',
    options: 'Vaihtoehto 1,Vaihtoehto 2,Vaihtoehto 3',
    required: false,
    public: true,
  },
];

const signups = [];

const answers = [];

const sampleAttendees = [{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"}]; // eslint-disable-line
const sampleAnswers = ["User-centric even-keeled ability","Diverse asynchronous migration","Enhanced attitude-oriented interface","Virtual directional complexity","Business-focused 24/7 synergy","Streamlined encompassing intranet","Reverse-engineered uniform encryption","Synergistic web-enabled throughput","User-centric web-enabled installation","Mandatory cohesive attitude","Profound human-resource software","Digitized transitional implementation","Extended impactful concept","Cross-platform composite open architecture","Synergized 24/7 matrices","Monitored asymmetric strategy","Vision-oriented scalable function","Inverse foreground forecast","Switchable 5th generation toolset","Phased local focus group","User-centric needs-based benchmark","Distributed mobile matrix","Innovative motivating matrix","Fully-configurable demand-driven matrix","Universal systemic groupware","Expanded bifurcated instruction set","Total human-resource contingency","Organic radical migration","Total non-volatile productivity","Persevering foreground migration","Progressive uniform conglomeration","Diverse tangible software","Enterprise-wide modular protocol","Cross-group intermediate system engine","Stand-alone incremental conglomeration","Monitored exuding architecture","Reverse-engineered human-resource forecast","Pre-emptive systematic projection","Operative zero tolerance data-warehouse","Adaptive object-oriented structure","Compatible user-facing challenge","Cross-platform mobile firmware","Focused local hardware","User-friendly composite encoding","Self-enabling homogeneous knowledge base","Enterprise-wide incremental process improvement","Reverse-engineered fresh-thinking product","Diverse neutral initiative","Focused attitude-oriented conglomeration","Enterprise-wide cohesive flexibility","Right-sized local definition","Quality-focused zero administration system engine","Synchronised dynamic architecture","Operative bifurcated success","Fundamental transitional core","Innovative explicit emulation","Function-based hybrid algorithm","Progressive contextually-based alliance","Seamless neutral alliance","Visionary encompassing array","Open-architected full-range budgetary management","Down-sized context-sensitive neural-net","Pre-emptive dedicated framework","Monitored actuating neural-net","Cross-group scalable adapter","Function-based asymmetric contingency","Object-based 24/7 data-warehouse","User-friendly demand-driven neural-net","User-friendly optimizing parallelism","Virtual needs-based data-warehouse","Expanded mobile archive","Self-enabling holistic customer loyalty","Monitored eco-centric array","Implemented 5th generation forecast","Future-proofed radical productivity","Cloned homogeneous encryption","Automated value-added array","Grass-roots attitude-oriented matrices","Switchable bottom-line success","Balanced logistical complexity","Networked mission-critical instruction set","Horizontal real-time leverage","Customer-focused logistical matrix","Profit-focused modular structure","Organic empowering conglomeration","Managed non-volatile concept","Sharable full-range pricing structure","Optimized heuristic attitude","Upgradable client-driven workforce","Organic fresh-thinking parallelism","Networked bottom-line archive","Self-enabling neutral capacity","Managed systemic help-desk","Balanced modular attitude","User-friendly optimal hierarchy","Customizable high-level encryption","Integrated local knowledge base","Profound full-range instruction set","Adaptive tertiary function","Mandatory human-resource time-frame"]; // eslint-disable-line

let signupIndex = 0;

const createAnswers = (eventId, signupId) => {
  const questionsToAnswer = _.filter(questions, ['eventId', eventId]) || [];
  if (questionsToAnswer.length > 0) {
    questionsToAnswer.map(question =>
      answers.push({
        signupId,
        questionId: question.id,
        answer: _.sample(sampleAnswers),
      }) // eslint-disable-line
    );
  }
  return true;
};

quotas.map((quota, quotaIndex) => {
  for (let i = 0; i < quota.going; i += 1) {
    const attendee = _.sample(sampleAttendees);

    signups.push({
      quotaId: quotaIndex + 1,
      timestamp: '2017-1-11 17:00:00',
      attendee: attendee.name,
      email: attendee.email,
    });

    signupIndex += 1;

    createAnswers(quota.eventId, signupIndex);
  }
  return true;
});

db('events').insert(events)
  .then(() => db('quotas').insert(quotas))
  .then(() => db('questions').insert(questions))
  .then(() => debug(`${events.length} events with ${quotas.length} quotas and ${questions.length} questions created.`))
  .then(() => db('signups').insert(signups))
  .then(() => db('answers').insert(answers))
  .then(() => debug(`${signups.length} signups with ${answers.length} answers added.`))
  .then(() => db.destroy())
  .then(() => debug('Creating fake data finished.'));
<commit_msg>Smart dates to event creating<commit_after>const debug = require('debug')('app:script');
const knex = require('knex');
const _ = require('lodash');
const moment = require('moment');
const config = require('../config/ilmomasiina.config.js');

const db = knex({
  client: 'mysql',
  connection: {
    user: config.mysqlUser,
    password: <PASSWORD>,
    database: config.mysqlDatabase,
  },
});

// Let's create all the times relative to current date, so we can use the same
// script after years
const now = moment().startOf('hour');
// Date format for knex
const d = 'Y-M-D HH:mm:ss';

const events = [
  {
    title: 'Minuuttikalja 2016',
    date: moment(now).subtract(10, 'days').format(d),
    description: 'Legendaarinen wappufiiliksen pikakohottaja, Minuuttikalja',
    price: '',
    location: 'Smökki (Jämeräntaival 4, Espoo)',
    homepage: '',
    facebooklink: 'https://www.facebook.com/events/1715883881987829/',
  },
  {
    title: 'Columbia Road -excu',
    date: moment(now).add(5, 'days').format(d),
    description: 'Tapahtuma, jossa kiintiöt aukeavat eri aikoihin. Columbia Road toivottaa athenelaiset ja tikkiläiset\n\nMonen rivin kuvaus\n\nlorem dorem', // eslint-disable-line
    price: '0 €',
    location: 'Eerikinkatu 5, Helsinki',
    homepage: 'http://crexcu2017.wordpress.com/',
    facebooklink: '',
  },
  {
    title: 'Ystävänpäiväsitsit',
    date: moment(now).add(15, 'days').format(d),
    description: 'Sitsit kiintiöillä',
    price: '14 € (12 € alkoholiton)',
    location: 'Smökki',
    homepage: 'http://crexcu2017.wordpress.com/',
    facebooklink: '',
  },
  {
    title: '<NAME>',
    description: 'Lorem ipsum. Lomake kaikilla kentillä.',
    facebooklink: 'https://www.facebook.com/events/1715883881987829/',
  },
];

const quotas = [
  {
    eventId: 1,
    title: 'Minuuttikalja 2016',
    going: 18,
    size: 20,
    signupOpens: moment(now).subtract(50, 'days').format(d),
    signupCloses: moment(now).subtract(35, 'days').format(d),
  },
  {
    eventId: 2,
    title: 'Athene',
    going: 0,
    size: 20,
    signupOpens: moment(now).add(2, 'days').format(d),
    signupCloses: moment(now).add(10, 'days').format(d),
  },
  {
    eventId: 2,
    title: 'Tietokilta',
    going: 19,
    size: 20,
    signupOpens: moment(now).add(2, 'days').format(d),
    signupCloses: moment(now).add(5, 'days').format(d),
  },
  {
    eventId: 3,
    title: 'Athene',
    going: 2,
    size: 20,
    signupOpens: moment(now).subtract(2, 'days').format(d),
    signupCloses: moment(now).add(5, 'days').format(d),
  },
  {
    eventId: 3,
    title: 'Prodeko',
    going: 15,
    size: 20,
    signupOpens: moment(now).subtract(2, 'days').format(d),
    signupCloses: moment(now).add(5, 'days').format(d),
  },
  {
    eventId: 3,
    title: 'Tietokilta',
    going: 20,
    size: 20,
    signupOpens: moment(now).subtract(2, 'days').format(d),
    signupCloses: moment(now).add(5, 'days').format(d),
  },
  {
    eventId: 4,
    title: 'Athene Alumni',
    going: 5,
  },
];

const questions = [
  {
    id: 1,
    eventId: 3,
    type: 'text',
    question: 'Pöytätoive',
    required: true,
    public: false,
  },
  {
    id: 2,
    eventId: 4,
    type: 'text',
    question: 'Valmistumisvuosi',
    required: true,
    public: false,
  },
  {
    id: 3,
    eventId: 4,
    type: 'textarea',
    question: 'Terveiset',
    required: true,
    public: true,
  },
  {
    id: 4,
    eventId: 4,
    type: 'select',
    question: 'Monivalinta',
    options: 'Vaihtoehto 1,Vaihtoehto 2,Vaihtoehto 3',
    required: true,
    public: true,
  },
  {
    id: 5,
    eventId: 3,
    type: 'checkbox',
    question: 'Valintaruudut',
    options: 'Vaihtoehto 1,Vaihtoehto 2,Vaihtoehto 3',
    required: false,
    public: true,
  },
];

const signups = [];

const answers = [];

const sampleAttendees = [{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"},{name:"<NAME>",email:"<EMAIL>"}]; // eslint-disable-line
const sampleAnswers = ["User-centric even-keeled ability","Diverse asynchronous migration","Enhanced attitude-oriented interface","Virtual directional complexity","Business-focused 24/7 synergy","Streamlined encompassing intranet","Reverse-engineered uniform encryption","Synergistic web-enabled throughput","User-centric web-enabled installation","Mandatory cohesive attitude","Profound human-resource software","Digitized transitional implementation","Extended impactful concept","Cross-platform composite open architecture","Synergized 24/7 matrices","Monitored asymmetric strategy","Vision-oriented scalable function","Inverse foreground forecast","Switchable 5th generation toolset","Phased local focus group","User-centric needs-based benchmark","Distributed mobile matrix","Innovative motivating matrix","Fully-configurable demand-driven matrix","Universal systemic groupware","Expanded bifurcated instruction set","Total human-resource contingency","Organic radical migration","Total non-volatile productivity","Persevering foreground migration","Progressive uniform conglomeration","Diverse tangible software","Enterprise-wide modular protocol","Cross-group intermediate system engine","Stand-alone incremental conglomeration","Monitored exuding architecture","Reverse-engineered human-resource forecast","Pre-emptive systematic projection","Operative zero tolerance data-warehouse","Adaptive object-oriented structure","Compatible user-facing challenge","Cross-platform mobile firmware","Focused local hardware","User-friendly composite encoding","Self-enabling homogeneous knowledge base","Enterprise-wide incremental process improvement","Reverse-engineered fresh-thinking product","Diverse neutral initiative","Focused attitude-oriented conglomeration","Enterprise-wide cohesive flexibility","Right-sized local definition","Quality-focused zero administration system engine","Synchronised dynamic architecture","Operative bifurcated success","Fundamental transitional core","Innovative explicit emulation","Function-based hybrid algorithm","Progressive contextually-based alliance","Seamless neutral alliance","Visionary encompassing array","Open-architected full-range budgetary management","Down-sized context-sensitive neural-net","Pre-emptive dedicated framework","Monitored actuating neural-net","Cross-group scalable adapter","Function-based asymmetric contingency","Object-based 24/7 data-warehouse","User-friendly demand-driven neural-net","User-friendly optimizing parallelism","Virtual needs-based data-warehouse","Expanded mobile archive","Self-enabling holistic customer loyalty","Monitored eco-centric array","Implemented 5th generation forecast","Future-proofed radical productivity","Cloned homogeneous encryption","Automated value-added array","Grass-roots attitude-oriented matrices","Switchable bottom-line success","Balanced logistical complexity","Networked mission-critical instruction set","Horizontal real-time leverage","Customer-focused logistical matrix","Profit-focused modular structure","Organic empowering conglomeration","Managed non-volatile concept","Sharable full-range pricing structure","Optimized heuristic attitude","Upgradable client-driven workforce","Organic fresh-thinking parallelism","Networked bottom-line archive","Self-enabling neutral capacity","Managed systemic help-desk","Balanced modular attitude","User-friendly optimal hierarchy","Customizable high-level encryption","Integrated local knowledge base","Profound full-range instruction set","Adaptive tertiary function","Mandatory human-resource time-frame"]; // eslint-disable-line

let signupIndex = 0;

const createAnswers = (eventId, signupId) => {
  const questionsToAnswer = _.filter(questions, ['eventId', eventId]) || [];
  if (questionsToAnswer.length > 0) {
    questionsToAnswer.map(question =>
      answers.push({
        signupId,
        questionId: question.id,
        answer: _.sample(sampleAnswers),
      }) // eslint-disable-line
    );
  }
  return true;
};

quotas.map((quota, quotaIndex) => {
  for (let i = 0; i < quota.going; i += 1) {
    const attendee = _.sample(sampleAttendees);

    signups.push({
      quotaId: quotaIndex + 1,
      timestamp: moment(now).format(d),
      attendee: attendee.name,
      email: attendee.email,
    });

    signupIndex += 1;

    createAnswers(quota.eventId, signupIndex);
  }
  return true;
});

db('events').insert(events)
  .then(() => db('quotas').insert(quotas))
  .then(() => db('questions').insert(questions))
  .then(() => debug(`${events.length} events with ${quotas.length} quotas and ${questions.length} questions created.`))
  .then(() => db('signups').insert(signups))
  .then(() => db('answers').insert(answers))
  .then(() => debug(`${signups.length} signups with ${answers.length} answers added.`))
  .then(() => db.destroy())
  .then(() => debug('Creating fake data finished.'));

{'fraction_non_alphanumeric': 0.2253261242705115, 'fraction_numerical': 0.019867833848266393, 'mean_word_length': 6.70158625247852, 'pattern_counts': {'":': 0, '<': 404, '<?xml version=': 0, '>': 426, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '3487542', 'n_tokens_mistral': 8307, 'n_tokens_neox': 7717, 'n_words': 1218}