<commit_before>const express = require('express');
const router = express.Router();

const env = require('dotenv').config()
const gb = require('../utils/queryGB')

const moment = require('moment')

const Knex = require('knex');
const knexConfig = require('../knexfile');
const knex = Knex(knexConfig[process.env.NODE_ENV || 'development']);

router.get('/', (req, res, next) => {
    res.render('import')
})


router.post('/', (req, res, next) => {
    knex('games').insert({ title: req.body.title, releaseDate: req.body.date, bgcover: req.body.bgcover })
    .then((done) => {
        console.log(`Added ${req.body.title} to the database.`)
        res.redirect('/')
    })
    .catch((err) => {
        console.log('I died!', err)
    })
})

router.post('/confirm', (req, res, next) => {
    gb.queryByName(req.body.title)
    .then((games) => {
        return gb.queryByID(games.data.results[0].id)
    })
    .then((games) => {
        let game = {}

        game.title = games.data.results.name
        game.date = moment(`${games.data.results.original_release_date} GMT`)
        game.bgcover = "http://scd.thingsima.de/img/bgcover/placeholder.jpg"

        res.render('confirm', { "game": game })
    })
})

module.exports = router<commit_msg>Fixed hardcoded placeholder img<commit_after>const express = require('express');
const router = express.Router();

const env = require('dotenv').config()
const gb = require('../utils/queryGB')

const moment = require('moment')

const Knex = require('knex');
const knexConfig = require('../knexfile');
const knex = Knex(knexConfig[process.env.NODE_ENV || 'development']);

router.get('/', (req, res, next) => {
    res.render('import')
})


router.post('/', (req, res, next) => {
    knex('games').insert({ title: req.body.title, releaseDate: req.body.date, bgcover: req.body.bgcover })
    .then((done) => {
        console.log(`Added ${req.body.title} to the database.`)
        res.redirect('/')
    })
    .catch((err) => {
        console.log('I died!', err)
    })
})

router.post('/confirm', (req, res, next) => {
    gb.queryByName(req.body.title)
    .then((games) => {
        return gb.queryByID(games.data.results[0].id)
    })
    .then((games) => {
        let game = {}

        game.title = games.data.results.name
        game.date = moment(`${games.data.results.original_release_date} GMT`)
        game.bgcover = "http://files.thingsima.de/img/bgcover/placeholder.jpg"

        res.render('confirm', { "game": game })
    })
})

module.exports = router
{'fraction_non_alphanumeric': 0.2, 'fraction_numerical': 0.0007936507936507937, 'mean_word_length': 3.16006600660066, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 17, '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': '1022118', 'n_tokens_mistral': 853, 'n_tokens_neox': 829, 'n_words': 152}