<commit_before>_     = require('lodash')
cs    = require('calmsoul')
store = require('./peteshow-storage')

class PeteshowController
  fillOutForms: =>
    cs.log('PeteshowController::fillOutForms')

    @fillInputs()
    @fillRadioButtons($('input:radio'))
    @fillCheckboxes($('input:checkbox'))
    @fillSelectBoxes($('select'))

  fillOutFormsAndSubmit: =>
    cs.log('PeteshowController::fillOutFormsAndSubmit')
    @fillOutForms()
    $(Peteshow.options.form).submit()
    $('form[name*=registration], .simple_form').submit()
    $('form').last().submit()

  fillInputs: ->
    cs.log('PeteshowController::fillInputs')
    saved = Peteshow.options.saved
    for element, rule of Peteshow.options.rules
      value = if _.isFunction(rule) then rule() else rule

      # Well, we've made it this far. Let's go ahead and fill this form out
      $(element).each (i, el) ->
        # Restore saved fields values from the saved option
        key = _.findKey(saved, (v, k) -> $(el).is(k))<commit_msg>not using peteshow-storage here, yet<commit_after>_     = require('lodash')
cs    = require('calmsoul')

class PeteshowController
  fillOutForms: =>
    cs.log('PeteshowController::fillOutForms')

    @fillInputs()
    @fillRadioButtons($('input:radio'))
    @fillCheckboxes($('input:checkbox'))
    @fillSelectBoxes($('select'))

  fillOutFormsAndSubmit: =>
    cs.log('PeteshowController::fillOutFormsAndSubmit')
    @fillOutForms()
    $(Peteshow.options.form).submit()
    $('form[name*=registration], .simple_form').submit()
    $('form').last().submit()

  fillInputs: ->
    cs.log('PeteshowController::fillInputs')
    saved = Peteshow.options.saved
    for element, rule of Peteshow.options.rules
      value = if _.isFunction(rule) then rule() else rule

      # Well, we've made it this far. Let's go ahead and fill this form out
      $(element).each (i, el) ->
        # Restore saved fields values from the saved option
        key = _.findKey(saved, (v, k) -> $(el).is(k))
{'fraction_non_alphanumeric': 0.1568627450980392, 'fraction_numerical': 0.0, 'mean_word_length': 3.7836538461538463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3377884', 'n_tokens_mistral': 635, 'n_tokens_neox': 624, 'n_words': 135}