<commit_before>/*
 * Copyright (c) 2014-2020 <NAME>.
 * SPDX-License-Identifier: MIT
 */
const models = require('../models/index')
const fuzz = require('fuzzball')

async function productPrice (query, user) {
  const [products] = await models.sequelize.query('SELECT * FROM Products')
  const queriedProducts = products
    .filter((product) => fuzz.partial_ratio(query, product.name) > 75)
    .map((product) => `${product.name}: ${product.price}¤`)
  return {
    action: 'response',
    body: queriedProducts.length > 0 ? queriedProducts.join(`
    `) : 'Sorry I couldn\'t find any products with that name'
  }
}

function testFunction (query, user) {
  return {
    action: 'response',
    body: '3be2e438b7f3d04c89d7749f727bb3bd'
  }
}

module.exports = {
  productPrice,<commit_msg>Use more natural language for price information<commit_after>/*
 * Copyright (c) 2014-2020 <NAME>.
 * SPDX-License-Identifier: MIT
 */
const models = require('../models/index')
const fuzz = require('fuzzball')

async function productPrice (query, user) {
  const [products] = await models.sequelize.query('SELECT * FROM Products')
  const queriedProducts = products
    .filter((product) => fuzz.partial_ratio(query, product.name) > 75)
    .map((product) => `${product.name} costs ${product.price}¤`)
  return {
    action: 'response',
    body: queriedProducts.length > 0 ? queriedProducts.join(`, `) : 'Sorry I couldn\'t find any products with that name'
  }
}

function testFunction (query, user) {
  return {
    action: 'response',
    body: '3be2e438b7f3d04c89d7749f727bb3bd'
  }
}

module.exports = {
  productPrice,
{'fraction_non_alphanumeric': 0.14640198511166252, 'fraction_numerical': 0.03722084367245657, 'mean_word_length': 4.1369426751592355, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3342240', 'n_tokens_mistral': 565, 'n_tokens_neox': 523, 'n_words': 128}