<commit_before>'use strict'

const get = require('./src/request')
const { loadFile } = require('./src/utils')
const { auth, url, goal } = require('./src/configs')
const parser = require('./src/parser')

const printIssue = issue => console.log( `${issue.key} -> ${issue.difficulty} -> ${issue.pontuation}` )

const print = data => {
    const jira = parser(data)
    const issues = jira.scoredIssues()

    issues.map( printIssue )

    console.log(`\n\nTotal Not Classified Issues: ${jira.notClassifiedIssues()}`)
    console.log(`Total Very Simple Issues: ${jira.verySimpleIssues()}`)
    console.log(`Total Simple Issues: ${jira.simpleIssues()}`)
    console.log(`Total Medium Issues: ${jira.mediumIssues()}`)
    console.log(`Total Hard Issues: ${jira.hardIssues()}`)
    console.log(`Total Very Hard Issues: ${jira.veryHardIssues()}`)
    console.log(`Total Customer Service: ${jira.customerService()}`)
    console.log(`Total Customer Service Time: ${jira.customerServiceTime()} minutes`)
    console.log(`Total issues: ${jira.scored()}`)
    console.log(`Total pontuation: ${jira.pontuation()}`)
    console.log(`Goal: ${goal()}`)
}

const startDate = '2017-06-01'
const endDate = '2017-06-30'

const filterUrl = url( startDate, endDate )
const headers = { 'Authorization': `Basic ${auth()}` }
const options = { headers }

get(filterUrl, options)
    .then( response => print(response.data) )
    .catch( response => console.log( `Error: ${response.message}` ) )<commit_msg>update index to use the new API<commit_after>'use strict'

const get = require('./src/request')
const { loadFile } = require('./src/utils')
const { auth, url, goal } = require('./src/configs')
const parser = require('./src/parser')

const printIssue = issue => console.log( `${issue.key} -> ${issue.difficulty} -> ${issue.pontuation}` )

const print = data => {
    const jira = parser(data)
    const issues = jira.scoredIssues()
    const issuesByDifficulty = jira.totalIssuesByDifficulty

    issues.map( printIssue )

    console.log(`\n\nTotal Not Classified Issues: ${issuesByDifficulty.notClassified}`)
    console.log(`Total Very Simple Issues: ${issuesByDifficulty.verySimple}`)
    console.log(`Total Simple Issues: ${issuesByDifficulty.simple}`)
    console.log(`Total Medium Issues: ${issuesByDifficulty.medium}`)
    console.log(`Total Hard Issues: ${issuesByDifficulty.hard}`)
    console.log(`Total Very Hard Issues: ${issuesByDifficulty.veryHard}`)
    console.log(`Total Customer Service: ${jira.customerService()}`)
    console.log(`Total Customer Service Time: ${jira.customerServiceTime()} minutes`)
    console.log(`Total issues: ${jira.scored()}`)
    console.log(`Total pontuation: ${jira.pontuation()}`)
    console.log(`Goal: ${goal()}`)
}

const startDate = '2017-07-01'
const endDate = '2017-07-31'

const filterUrl = url( startDate, endDate )
const headers = { 'Authorization': `Basic ${auth()}` }
const options = { headers }

get(filterUrl, options)
    .then( response => print(response.data) )
    .catch( response => console.log( `Error: ${response.message}` ) )
{'fraction_non_alphanumeric': 0.1730644111906311, 'fraction_numerical': 0.01040988939492518, 'mean_word_length': 4.611313868613139, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6040684', 'n_tokens_mistral': 1004, 'n_tokens_neox': 969, 'n_words': 225}