<commit_before>import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';

@Component({
    selector: 'app-task-list',
    templateUrl: './task-list.component.html',
    styleUrls: ['./task-list.component.css']
})
export class TaskListComponent implements OnInit {
    tasks = [];
    doneTasks = [];

    constructor(private http: Http) {}

    ngOnInit() {
        this.fetchTasks();
    }

    private fetchTasks() {
        this.http.get('../tasks').subscribe(
            data => this.tasks = JSON.parse(data['_body']).tasks,
            error => alert('An error occurred: ' + error)
        );
        this.http.get('../tasks/done').subscribe(
            data => this.doneTasks = JSON.parse(data['_body']).tasks,
            error => alert('An error occurred: ' + error)
        );
    }

    onDeleteClick(id: number) {
        this.http.delete('../tasks/' + id).subscribe(
            () => this.fetchTasks(),
            error => alert('An error occurred: ' + error)
        );
    }

    onDoneClick(id: number) {
        const taskToUpdate = this.tasks.find((task) => { return task.id === id; });
        taskToUpdate.done = true;
        this.http.put('../tasks/' + id, JSON.stringify(taskToUpdate)).subscribe(<commit_msg>fetchTasks() changed from private to public.<commit_after>import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';

@Component({
    selector: 'app-task-list',
    templateUrl: './task-list.component.html',
    styleUrls: ['./task-list.component.css']
})
export class TaskListComponent implements OnInit {
    tasks = [];
    doneTasks = [];

    constructor(private http: Http) {}

    ngOnInit() {
        this.fetchTasks();
    }

    public fetchTasks() {
        this.http.get('../tasks').subscribe(
            data => this.tasks = JSON.parse(data['_body']).tasks,
            error => alert('An error occurred: ' + error)
        );
        this.http.get('../tasks/done').subscribe(
            data => this.doneTasks = JSON.parse(data['_body']).tasks,
            error => alert('An error occurred: ' + error)
        );
    }

    onDeleteClick(id: number) {
        this.http.delete('../tasks/' + id).subscribe(
            () => this.fetchTasks(),
            error => alert('An error occurred: ' + error)
        );
    }

    onDoneClick(id: number) {
        const taskToUpdate = this.tasks.find((task) => { return task.id === id; });
        taskToUpdate.done = true;
        this.http.put('../tasks/' + id, JSON.stringify(taskToUpdate)).subscribe(
{'fraction_non_alphanumeric': 0.173046875, 'fraction_numerical': 0.0, 'mean_word_length': 2.3564875491480994, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5100965', 'n_tokens_mistral': 752, 'n_tokens_neox': 742, 'n_words': 146}