<commit_before>import { Hook } from './interfaces';
import LobbyController from './ctrl';

interface Filtered {
  visible: Hook[];
  hidden: number;
}

export default function(ctrl: LobbyController, hooks: Hook[]): Filtered {
  const f = ctrl.data.filter,
    seen: string[] = [],
    visible: Hook[] = [];
  let variant: string, hidden = 0;
  hooks.forEach(function(hook) {
    variant = hook.variant;
    if (hook.action === 'cancel') visible.push(hook);
    else {
      if (!f.variant.includes(variant) ||
        !f.mode.includes(hook.ra || 0) ||
        !f.speed.includes(hook.s || 1 /* ultrabullet = bullet */) ||
        (f.increment.length && f.increment.includes(hook.i || 0)) ||
        (f.rating && (!hook.rating || (hook.rating < f.rating[0] || hook.rating > f.rating[1])))) {
        hidden++;
      } else {
        const hash = hook.ra + variant + hook.t + hook.rating;
        if (!seen.includes(hash)) visible.push(hook);
        seen.push(hash);
      }
    }
  });
  return {
    visible: visible,
    hidden: hidden
  };
}<commit_msg>Revert "invert lobby increment filter"<commit_after>import { Hook } from './interfaces';
import LobbyController from './ctrl';

interface Filtered {
  visible: Hook[];
  hidden: number;
}

export default function(ctrl: LobbyController, hooks: Hook[]): Filtered {
  const f = ctrl.data.filter,
    seen: string[] = [],
    visible: Hook[] = [];
  let variant: string, hidden = 0;
  hooks.forEach(function(hook) {
    variant = hook.variant;
    if (hook.action === 'cancel') visible.push(hook);
    else {
      if (!f.variant.includes(variant) ||
        !f.mode.includes(hook.ra || 0) ||
        !f.speed.includes(hook.s || 1 /* ultrabullet = bullet */) ||
        (f.increment.length && !f.increment.includes(hook.i || 0)) ||
        (f.rating && (!hook.rating || (hook.rating < f.rating[0] || hook.rating > f.rating[1])))) {
        hidden++;
      } else {
        const hash = hook.ra + variant + hook.t + hook.rating;
        if (!seen.includes(hash)) visible.push(hook);
        seen.push(hash);
      }
    }
  });
  return {
    visible: visible,
    hidden: hidden
  };
}
{'fraction_non_alphanumeric': 0.17837078651685392, 'fraction_numerical': 0.0056179775280898875, 'mean_word_length': 2.690846286701209, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6307753', 'n_tokens_mistral': 695, 'n_tokens_neox': 687, 'n_words': 154}