<commit_before>import express from 'express'
const router = express.Router()

import { Subject, Card } from '../database/db'

router.get('/:id', (request, response, next ) => {
  const { id } = request.params
  console.log( 'subject', id )

  const query = [ Subject.find( id ), Card.findBySubjectId( id ) ]

  Promise.all( query )
    .then( result => {
      const [ subject, cards ] = result
      response.render( 'subjects', { subject, cards } )
    })

  Subject.find( id ).then( subject => {
    response.render('subjects', { subject })
  })
})

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

router.post('/create-subject', ( request, response ) => {
  const { id } = request.user
  const { title } = request.body

  Subject.create( title, id ).then( result => {
    res.redirect(`/subjects/${result.id}`)
  })
})

module.exports = router
<commit_msg>refactored changes<commit_after>import express from 'express'
const router = express.Router()

import { Subject, Card } from '../database/db'

router.get('/:id', (request, response, next ) => {
  const { id } = request.params
  const query = [ Subject.find( id ), Card.findBySubjectId( id ) ]

  Promise.all( query )
    .then( result => {
      const [ subject, cards ] = result
      response.render( 'subjects', { subject, cards } )
    })
})

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

router.post('/create-subject', ( request, response ) => {
  const { id } = request.user
  const { title } = request.body

  Subject.create( title, id ).then( result => {
    res.redirect(`/subjects/${result.id}`)
  })
})

module.exports = router

{'fraction_non_alphanumeric': 0.18214716525934863, 'fraction_numerical': 0.0, 'mean_word_length': 3.2647814910025708, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '612520', 'n_tokens_mistral': 535, 'n_tokens_neox': 530, 'n_words': 128}