<commit_before>//@flow

import Chart from '../../../models/Chart';

export default async function (ctx) {
  await ctx.checkAbility('admin');
  //abilities
  let id = ctx.query.id || ctx.error(404);

  let chart = await Chart.findById(id);

  if (!chart) ctx.error(404);

  if (chart.abilities) {
    for (let ability of chart.abilities) {
      await ctx.checkAbility(ability);
    }
  }

  ctx.body = await chart.getData(ctx);
}<commit_msg>findById<commit_after>//@flow

import Chart from '../../../models/Chart';

export default async function (ctx) {
  await ctx.checkAbility('admin');
  //abilities
  let id = ctx.query.id || ctx.error(404);
  // $Flow  findById
  let chart: Chart = await Chart.findById(id);

  if (!chart) ctx.error(404);

  if (chart.abilities) {
    for (let ability of chart.abilities) {
      await ctx.checkAbility(ability);
    }
  }

  ctx.body = await chart.getData(ctx);
}
{'fraction_non_alphanumeric': 0.16371681415929204, 'fraction_numerical': 0.01327433628318584, 'mean_word_length': 3.0950226244343892, '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': '2012250', 'n_tokens_mistral': 311, 'n_tokens_neox': 302, 'n_words': 75}