<commit_before>define(function(require) {

    'use strict';

    var _                = require('underscore')
      , Base             = require('app/views/Base')
      , autosize         = require('autosize')
      , Thankyou         = require('app/views/Report/Thankyou')
      , File             = require('app/models/File')
      , user             = require('app/store/User')
      , log              = require('bows.min')('Views:Report:Description')

    return Base.extend({

      template: _.template(require('text!tpl/Report/Description.html')),

      requiresLogin: true,

      title: 'Add Description',

      className: 'report screen',

      events: {
        'submit form': 'send',
        'click .js-back': 'back'
      },

      initialize: function(options) {
        this.options = options
        this.router = options.router
        if (localStorage.uploads && window.File && window.FileReader && window.FileList && window.Blob) {
          this.model.set('canUploadFiles', true)
          this.file = new File({ jid: user.get('channelJid') })
        } else {
          log('The File APIs are not fully supported in this browser.')
          this.model.set('canUploadFiles', false)
        }
      },

      afterRender: function() {
        this.input = this.$('.js-description')
        autosize(this.input)
      },

      send: function(event) {
        event.preventDefault()
        this.showSpinner('Sending Report')
        if (!this.file) {
          return this.sendReport()
        }
        this.file.on('error:file', function(message) {
          this.error(message)
        }, this)
        this.file.on('change:id', function(url) {
          log('success', arguments)
          this.sendReport()
        }, this)
        this.file.upload(event)

      },

      sendReport: function(error) {
        this.model.set('description', this.$('.js-description').val())

        if ('home' === this.model.get('category')) {
          this.model.set(
            'idNumber',
            this.$('.js-municipal-account-number').val()
          )
        }

        // also upload photo(s) from this.$('.js-photos').val()

        log('Attempting to create a ticket', this.model)
        this.model.once('ticket:success', _.bind(this.success, this))
        this.model.once('ticket:error', _.bind(this.error, this))
        this.model.save()
        
      },

      error: function(error) {
        this.closeSpinner()
        this.showError(
          'Unfortunately we couldn\'t post your report. ' +
          'Please try again later.'
        )
      },

      success: function() {
        console.log(arguments)
        this.closeSpinner()<commit_msg>Attach image details to report<commit_after>define(function(require) {

    'use strict';

    var _                = require('underscore')
      , Base             = require('app/views/Base')
      , autosize         = require('autosize')
      , Thankyou         = require('app/views/Report/Thankyou')
      , File             = require('app/models/File')
      , user             = require('app/store/User')
      , log              = require('bows.min')('Views:Report:Description')

    return Base.extend({

      template: _.template(require('text!tpl/Report/Description.html')),

      requiresLogin: true,

      title: 'Add Description',

      className: 'report screen',

      events: {
        'submit form': 'send',
        'click .js-back': 'back'
      },

      initialize: function(options) {
        this.options = options
        this.router = options.router
        if (localStorage.uploads && window.File && window.FileReader && window.FileList && window.Blob) {
          this.model.set('canUploadFiles', true)
          this.file = new File({ jid: user.get('channelJid') })
        } else {
          log('The File APIs are not fully supported in this browser.')
          this.model.set('canUploadFiles', false)
        }
      },

      afterRender: function() {
        this.input = this.$('.js-description')
        autosize(this.input)
      },

      send: function(event) {
        event.preventDefault()
        this.showSpinner('Sending Report')
        if (!this.file) {
          return this.sendReport()
        }
        this.file.on('error:file', function(message) {
          this.error(message)
        }, this)
        this.file.on('change:id', function(details) {
          this.sendReport(details.url + '/' + details.id)
        }, this)
        this.file.upload(event)

      },

      sendReport: function(imageUrl) {
        this.model.set('description', this.$('.js-description').val())

        if ('home' === this.model.get('category')) {
          this.model.set(
            'idNumber',
            this.$('.js-municipal-account-number').val()
          )
        }
        if (imageUrl) {
          this.model.set(
            'description',
            this.model.get('description')
              + '\n\nThe following image was attached: '
              + imageUrl
            )
        }

        // also upload photo(s) from this.$('.js-photos').val()

        log('Attempting to create a ticket', this.model)
        this.model.once('ticket:success', _.bind(this.success, this))
        this.model.once('ticket:error', _.bind(this.error, this))
        this.model.save()
        
      },

      error: function(error) {
        this.closeSpinner()
        this.showError(
          'Unfortunately we couldn\'t post your report. ' +
          'Please try again later.'
        )
      },

      success: function() {
        this.closeSpinner()
{'fraction_non_alphanumeric': 0.14549033643521833, 'fraction_numerical': 0.0, 'mean_word_length': 1.8442748091603054, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3098734', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1544, 'n_words': 290}