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

import { AngularFireDatabase } from 'angularfire2/database';

import { GoogleBooks } from 'app/shared/services/googleBooks.service';

import { Book } from 'types/book';

@Component({
  selector: 'create-book',
  templateUrl: './create-book.component.html',
  styleUrls: ['./create-book.component.scss']
})
export class CreateBookComponent {
  title: string;
  author: string;
  date: Date;
  publisher: string;
  description: string;
  imageUrl: string;

  private database: AngularFireDatabase;
  private http: Http;
  private api: GoogleBooks;

  constructor(http: Http, database: AngularFireDatabase, api: GoogleBooks) {
    this.api = api;
    this.database = database;
    this.http = http;
  }

  save(): void {
    this.api.volume(this.title).subscribe((result) => {
      const volume = result.json();
      const imageDefault = '/assets/logo.png';
      const book = volume.items && volume.items.length > 0 ? volume.items[0] : imageDefault;
      const imageUrl = book.imageLinks ? book.imageLinks.thumbnail ? book.imageLinks.thumbnail : imageDefault : imageDefault;

      this.database.list('/books').push({
        title: this.title,
        author: this.author,
        date: this.date.toJSON(),
        score: 0,
        publisher: this.publisher,
        description: this.description,
        imageUrl: imageUrl
      });
    });
  }
}
<commit_msg>fix(create-book): change the attribute name of book<commit_after>import { Component } from '@angular/core';
import { Http } from '@angular/http';

import { AngularFireDatabase } from 'angularfire2/database';

import { GoogleBooks } from 'app/shared/services/googleBooks.service';

import { Book } from 'types/book';

@Component({
  selector: 'create-book',
  templateUrl: './create-book.component.html',
  styleUrls: ['./create-book.component.scss']
})
export class CreateBookComponent {
  title: string;
  author: string;
  date: Date;
  publisher: string;
  description: string;
  imageUrl: string;

  private database: AngularFireDatabase;
  private http: Http;
  private api: GoogleBooks;

  constructor(http: Http, database: AngularFireDatabase, api: GoogleBooks) {
    this.api = api;
    this.database = database;
    this.http = http;
  }

  save(): void {
    this.api.volume(this.title).subscribe((result) => {
      const volume = result.json();
      const imageDefault = '/assets/logo.png';
      const book = volume.items && volume.items.length > 0 ? volume.items[0] : imageDefault;
      const imageUrl = book.imageLinks ? book.imageLinks.thumbnail ? book.imageLinks.thumbnail : imageDefault : imageDefault;

      this.database.list('/books').push({
        title: this.title,
        author: this.author,
        date: this.date.toJSON(),
        score: 0,
        publisher: this.publisher,
        description: this.description,
        image: imageUrl
      });
    });
  }
}

{'fraction_non_alphanumeric': 0.13324315184308422, 'fraction_numerical': 0.002705444707473791, 'mean_word_length': 3.324561403508772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1209845', 'n_tokens_mistral': 889, 'n_tokens_neox': 868, 'n_words': 208}