<commit_before>const knex = require('../../../knex').web
const orgUnitFinder = require('../helpers/org-unit-finder')

module.exports = function (id, type) {
  var orgUnit = orgUnitFinder('name', type)
  var table = 'reductions_notes_export_view'
  var whereClause = ''

  if (id !== undefined) {
    whereClause = ' WHERE ' + orgUnit.name + '_id = ' + id
  }

  var selectColumns = [
    'name AS offenderManager',
    'reduction_reason AS reason',
    'amount',
    'start_date AS startDate',
    'end_date AS endDate',
    'reduction_status AS status',
    'additional_notes AS additionalNotes'
  ]

  return knex.raw(
        'SELECT ' + selectColumns.join(', ') +
        ' FROM ' + table +
        whereClause)
    .then(function (results) {
      return results
    })
}<commit_msg>Remove unneeded .then function from reductions export data service<commit_after>const knex = require('../../../knex').web
const orgUnitFinder = require('../helpers/org-unit-finder')

module.exports = function (id, type) {
  var orgUnit = orgUnitFinder('name', type)
  var table = 'reductions_notes_export_view'
  var whereClause = ''

  if (id !== undefined) {
    whereClause = ' WHERE ' + orgUnit.name + '_id = ' + id
  }

  var selectColumns = [
    'name AS offenderManager',
    'reduction_reason AS reason',
    'amount',
    'start_date AS startDate',
    'end_date AS endDate',
    'reduction_status AS status',
    'additional_notes AS additionalNotes'
  ]

  return knex.raw(
        'SELECT ' + selectColumns.join(', ') +
        ' FROM ' + table +
        whereClause)
}
{'fraction_non_alphanumeric': 0.13885350318471337, 'fraction_numerical': 0.0, 'mean_word_length': 2.9974554707379135, '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': '3426232', 'n_tokens_mistral': 498, 'n_tokens_neox': 494, 'n_words': 122}