<commit_before>import { Workflow } from '../workflow';
import { WorkflowPostable } from './workflow-postable';

interface MilestoneOptions {
  title: string;
  postables: WorkflowPostable[];
  completedDetail: string;
}
export class Milestone {
  title: string;
  postables: WorkflowPostable[] = [];
  #includedPostables = new Set<WorkflowPostable>();
  #excludedPostables = new Set<WorkflowPostable>();
  workflow: Workflow | undefined;
  setWorkflow(wf: Workflow) {
    this.workflow = wf;
    this.postables.invoke('setWorkflow', wf);
  }
  get isComplete() {
    return this.postables
      .filter((p) => {
        return !this.#excludedPostables.has(p);
      })
      .isEvery('isComplete', true);
  }
  completedDetail;

  constructor(opts: MilestoneOptions) {
    this.title = opts.title;
    this.postables = opts.postables;
    this.completedDetail = opts.completedDetail;
  }

  get visiblePostables() {
    let postablesArr = [];

    for (let i = 0; i < this.postables.length; i++) {
      let post = this.postables[i];
      if (this.#excludedPostables.has(post)) {
        continue;
      }
      if (
        post.includeIf &&
        !this.#includedPostables.has(post) &&
        post.includeIf() == false
      ) {
        this.#excludedPostables.add(post);<commit_msg>Use visiblePostables directly to calculate a Milestone's completeness.<commit_after>import { Workflow } from '../workflow';
import { WorkflowPostable } from './workflow-postable';

interface MilestoneOptions {
  title: string;
  postables: WorkflowPostable[];
  completedDetail: string;
}
export class Milestone {
  title: string;
  postables: WorkflowPostable[] = [];
  #includedPostables = new Set<WorkflowPostable>();
  #excludedPostables = new Set<WorkflowPostable>();
  workflow: Workflow | undefined;
  setWorkflow(wf: Workflow) {
    this.workflow = wf;
    this.postables.invoke('setWorkflow', wf);
  }
  get isComplete() {
    return this.visiblePostables.isEvery('isComplete', true);
  }
  completedDetail;

  constructor(opts: MilestoneOptions) {
    this.title = opts.title;
    this.postables = opts.postables;
    this.completedDetail = opts.completedDetail;
  }

  get visiblePostables() {
    let postablesArr = [];

    for (let i = 0; i < this.postables.length; i++) {
      let post = this.postables[i];
      if (this.#excludedPostables.has(post)) {
        continue;
      }
      if (
        post.includeIf &&
        !this.#includedPostables.has(post) &&
        post.includeIf() == false
      ) {
        this.#excludedPostables.add(post);
{'fraction_non_alphanumeric': 0.13239326282804545, 'fraction_numerical': 0.0007833920877399138, 'mean_word_length': 3.2637729549248746, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 8, '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': '4115677', 'n_tokens_mistral': 817, 'n_tokens_neox': 798, 'n_words': 160}