<commit_before>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { Book } from '../../models/book/book.model';
import { BookService } from '../../services/book/book.service';
import params = require('../../params/params');
import 'rxjs/add/operator/switchMap';

@Component({
    selector: 'module-book-form',
    templateUrl: './app/modules/book_form/book_form.component.html'
})
export class ModBookFormComponent implements OnInit {
    book: Book = new Book(null, null, null, null, null, null, null, null, null, null, null, null, 1, null, null, null, 0);
    file : File;
    selectedValues = { };

    constructor(private route: ActivatedRoute, private router: Router, private book_service: BookService) {
        this.book_service.reset();
        this.route.params
            .switchMap((params: Params) => this.book_service.getBookForForm(params['id']))
            .subscribe((book: Book) => {
                // Update
                if (book.id) {
                    params.title = 'Update Book: ' + book.ten_sach;
                    params.breadcrumbs = [
                        { label: 'Books', url: '/book' },
                        { label: book.ten_sach, url: '/book/view/' + book.id },
                        { label: 'Update' }
                    ];
                    this.book = book;
                    setTimeout(() => {
                        this.selectedValues = {
                            category  : book.id_loai_sach + '',
                            publisher : book.id_nha_xuat_ban + '',
                            writer    : book.id_tac_gia + '',
                        }
                    }, 0);
                }
            })
        ;
    }

    ngOnInit() { }

    selectOnChange(property: string, value: number = null) {<commit_msg>03-complete-form<commit_after>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { Book } from '../../models/book/book.model';
import { BookService } from '../../services/book/book.service';
import params = require('../../params/params');
import 'rxjs/add/operator/switchMap';

@Component({
    selector: 'module-book-form',
    templateUrl: './app/modules/book_form/book_form.component.html'
})
export class ModBookFormComponent implements OnInit {
    book: Book = new Book(null, null, null, null, null, null, null, null, null, null, null, null, 1, null, null, null, 0);
    file : File;
    selectedValues = { };

    constructor(private route: ActivatedRoute, private router: Router, private book_service: BookService) {
        this.book_service.reset();
        this.route.params
            .switchMap((params: Params) => this.book_service.getBookForForm(params['id']))
            .subscribe((book: Book) => {
                // Update
                if (book.id) {
                    params.title = 'Update Book: ' + book.ten_sach;
                    params.breadcrumbs = [
                        { label: 'Books', url: '/book' },
                        { label: book.ten_sach, url: '/book/view/' + book.id },
                        { label: 'Update' }
                    ];
                    setTimeout(() => {
                        this.selectedValues = {
                            category  : book.id_loai_sach + '',
                            publisher : book.id_nha_xuat_ban + '',
                            writer    : book.id_tac_gia + '',
                        }
                    }, 0);
                    this.book = book;
                }
            })
        ;
    }

    ngOnInit() { }

    selectOnChange(property: string, value: number = null) {
{'fraction_non_alphanumeric': 0.13737590555406493, 'fraction_numerical': 0.0021464985242822645, 'mean_word_length': 1.63091037402964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1453781', 'n_tokens_mistral': 1036, 'n_tokens_neox': 998, 'n_words': 218}