<commit_before>import {
  Component,
  OnDestroy,
  trigger,
  style,
  animate,
  state,
  transition } from '@angular/core';
import { GoalService } from '../services/goal.service'
import { Router } from "@angular/router";
import { XLarge } from './x-large';
import { Store } from "../store";
import 'rxjs/Rx'


@Component({
  selector: 'goal',
  styleUrls: ['./goal.style.css'],
  animations: [
    trigger('fade', [
      state('void', style({opacity: 0})),
      transition('void => *', [
        animate(600, style({opacity: 1}))
      ]),
      transition('* => void', animate(1000))
    ])
  ],
  templateUrl: './goal.template.html',
})

export class Goal {
  goals = [];
  date = Date.now()
  USER_ID = window.localStorage.getItem('cpms_user_id')
  onLeave: boolean  = true
  constructor(
    public goalService: GoalService,
    public router: Router,
    private store: Store
  ) {
    this.goalService.getUserGoals(this.USER_ID)
      .subscribe(res => this.goals =  res);

    this.store.changes.pluck('goals')
      .subscribe();

    setTimeout(() => {
      this.toggle()
    },1000)
  }

  onCreateGoal(goal) {
    this.goalService.createGoal(goal)
      .subscribe(goal => this.goals.push(goal));
  }

  onGoalChecked(goal,i) {
    goal.done = true
    this.goalService.completeGoal(goal)
      .subscribe();
    this.goals.splice(i, 1);

  }

  toggle() {
    this.onLeave = !this.onLeave;
  }<commit_msg>adds notcompleted and completed goals<commit_after>import {
  Component,
  OnDestroy,
  trigger,
  style,
  animate,
  state,
  transition } from '@angular/core';
import { GoalService } from '../services/goal.service'
import { Router } from "@angular/router";
import { XLarge } from './x-large';
import { Store } from "../store";
import 'rxjs/Rx'


@Component({
  selector: 'goal',
  styleUrls: ['./goal.style.css'],
  animations: [
    trigger('fade', [
      state('void', style({opacity: 0})),
      transition('void => *', [
        animate(600, style({opacity: 1}))
      ]),
      transition('* => void', animate(1000))
    ])
  ],
  templateUrl: './goal.template.html',
})

export class Goal {
  goals = [];
  completedGoals = [];
  notCompletedGoals = [];
  date = Date.now()
  USER_ID = window.localStorage.getItem('cpms_user_id')
  onLeave: boolean  = true
  constructor(
    public goalService: GoalService,
    public router: Router,
    private store: Store
  ) {
    this.goalService.getUserGoals(this.USER_ID)
      .subscribe(res => {
        this.goals =  res
        res.map(goal => {
          if(goal.done === true ) {
            this.completedGoals.push(goal)
          } else {
            this.notCompletedGoals.push(goal)
          }
        })
      })



    this.store.changes.pluck('goals')
      .subscribe();

    setTimeout(() => {
      this.toggle()
    },1000)
  }


  onCreateGoal(goal) {
    this.goalService.createGoal(goal)
      .subscribe(goal => {
        this.goals.push(goal)
        this.notCompletedGoals.push(goal)
      });
  }

  onGoalChecked(goal,i) {
    goal.done = true
    this.goalService.completeGoal(goal)
      .subscribe();
    this.goals.splice(i, 1);

  }

  toggle() {
    this.onLeave = !this.onLeave;
  }
{'fraction_non_alphanumeric': 0.16290726817042606, 'fraction_numerical': 0.008771929824561403, 'mean_word_length': 2.670114942528736, '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': '4601782', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1066, 'n_words': 195}