<commit_before>//noinspection BadExpressionStatementJS
'format es6';

let name = 'movieService';

import { registerService } from 'nn-ng-utils';
import _ from 'lodash';

class MovieService {
  constructor ( ctx ) {
    //noinspection BadExpressionStatementJS
    'ngInject';

    this.ctx = ctx;
    this.movies = this.getFakeMovies();
  }

  createMovie ( newMovie ) {
    let newId = _.max( this.movies, 'id' ).id + 1;
    newMovie.id = newId;
    this.movies.push( newMovie );
    return this.ctx.$q.resolve( newMovie );
  }

  getDefaultImage () {
    //jscs:disable
    let defaultImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAC0CAYAAADfER1LAABTZElEQVR42u29eXgc1Zk1fm5VdfWi1r5Zu6zNsmVJeMFgyxCcGZLMQAIhCQkhAUIIgeQDkvkmIcSEkIR8yTwkk8lksk8yCfMLS0iwY4MN3sA4YBYveLex5EWyrF1q9VZdXVX3/v5QVVHd6m51t1rGNrrPo0e2eu869dZ5z/ve8/J47y4OAObOnVsqSdI2l8slq6q6nzEGADwAAoBhds2uCwXMTqfzxzpomSiKL1dWVi6Iug+Z/apm1/m8BD0qF3EcxwwwA2AcxzGHw/G/TU1NOZb787Nf2ew6XxcBALvdvlEHsUoIYYQQxQpql8v10KpVqyadBLNrdp1XUbmgoGAJIYQBoPpvE8QAVMv/R51O56d0Lm2cCNzs1zi7zovV1dUFAMd1wCoAmNPpjKAbhBBq3Kb/vFVUVHTpLJ+eXefL4gFAEIRP6oDV<KEY>'; // jshint ignore:line
    //jscs:enable
    return defaultImage;
  }

  getAll () {
    let promise = this.ctx.$q.resolve( this.movies );

    return promise;
  }

  getOne ( id ) {
    let movie = _.find( this.movies, movie => movie.id === parseInt( id ));
    let promise = this.ctx.$q.resolve( movie );

    return promise;
  }
<commit_msg>MovieService: add updateMovie() and update fake data<commit_after>//noinspection BadExpressionStatementJS
'format es6';

let name = 'movieService';

import { registerService } from 'nn-ng-utils';
import _ from 'lodash';

class MovieService {
  constructor ( ctx ) {
    //noinspection BadExpressionStatementJS
    'ngInject';

    this.ctx = ctx;
    this.movies = this.getFakeMovies();
  }

  createMovie ( newMovie ) {
    let newId = _.max( this.movies, 'id' ).id + 1;
    newMovie.id = newId;
    this.movies.push( newMovie );
    return this.ctx.$q.resolve( newMovie );
  }

  updateMovie ( updatedMovie ) {
    let existingMovie = _.find(
      this.movies, m => m.id === updatedMovie.id );

    _.assign( existingMovie, updatedMovie );

    let promise = this.ctx.$q.resolve( existingMovie );
    return promise;
  }

  getDefaultImage () {
    //jscs:disable
    let defaultImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAC0CAYAAADfER1LAABTZElEQVR42u29eXgc1Zk1fm5VdfWi1r5Zu6zNsmVJeMFgyxCcGZLMQAIhCQkhAUIIgeQDkvkmIcSEkIR8yTwkk8lksk8yCfMLS0iwY4MN3sA4YBYveLex5EWyrF1q9VZdXVX3/v5QVVHd6m51t1rGNrrPo0e2eu869dZ5z/ve8/J47y4OAObOnVsqSdI2l8slq6q6nzEGADwAAoBhds2uCwXMTqfzxzpomSiKL1dWVi6Iug+Z/apm1/m8BD0qF3EcxwwwA2AcxzGHw/G/TU1NOZb787Nf2ew6XxcBALvdvlEHsUoIYYQQxQpql8v10KpVqyadBLNrdp1XUbmgoGAJIYQBoPpvE8QAVMv/R51O56d0Lm2cCNzs1zi7zovV1dUFAMd1wCoAmNPpjKAbhBBq3Kb/vFVUVHTpLJ+eXefL4gFAEIRP6oDVjGj8k5/8hH39619n1dXVEVFavw/V78/sdvszNTU1pVHPOQvq8+Xgvod4Mv3ABz6Azs7ONwHYdHpBbrnlFrS3t0MQBKxcuRJFRUU4efIkQqEQABCO4whjjAIgmqbN93q9/5qVlZW1fPnyzadPn2YW+kJnIfUuJ0LvoRNXczgcD<KEY>ZBlmZWWltofeuih49u2bRvjOM6huxMZGnSV2+2+2u/3d1/sUXmWM5+7SG02MTHGzgDYAGArgCIAzTrwDC8tHoDt1KlT/ieffLJbkiR50aJF+aWlpS5JklRN0zTd8QiFhYW206dP+//93/+9C4DdomooACodDsefg8Hg33ARFkhmwXx+JImqHoU9hJAd2dnZ+8LhcCOAOryzE4YIgsBTSoV9+/aN/O///m9vUVER2traCtxutz0YDCqaprGioiL7N77xjSMDAwOKRaKjmKgWsqampjuGhoYMZ6eLHsyzNOPdzVcYANbV1YWFCxe+PxwOf0bTtBKdTysARJ7ned2+N1xWVuZevXp107Jly8pyc3Ptzz//fM999913EBMDj2ChKfV2u/3fZVn+I87TYTqzYL54QU0B4JprrsFLL710syRJ11FKbQBGdH4s6EYuGoDwsmXLSr785S/X/eu//uvbQ0NDCiHEpisYDEA2ISS0atWq63QHz/cExZgF83kK6oaGhtyenp7Py7J8lc61xzHRkyFgoofamEFu039IVFT+mizLL70Xkr7oL3B2nT+cmgAgnZ2d47Is/3tVVdVXRVHsAlCmJ3gyY0wTJpZd3xtoDPdRMGEbsOv3v//9S5bnfM+s2ch8fh8XRgiB2+1eIUnSraqqVgAY1aO1DZFtoAxAdX5+/ufGxsa63mtReVbNuDCODwuHwz1XXXXVs319fSFKaStjLA8TW6sMg0MFQKkoitsCgcB7RoqbBfOFtQxAcidPnmSqqh5paWnZMD4+nqNpWismtnUFMDFMxzF37tyvj46OXhS2AbPr4qceZo5TXl5eIYriQwD+CmCrw+G4eZY6zq4LFtQ6n15pt9u/X1dXl4tpDIy/GNb/D47nbfcp/lo0AAAAAElFTkSuQmCC'; // jshint ignore:line
    //jscs:enable
    return defaultImage;
  }

  getAll () {
    let promise = this.ctx.$q.resolve( this.movies );
    return promise;
  }

  getOne ( id ) {
    let movie = _.find( this.movies, movie => movie.id === parseInt( id ));
    let promise = this.ctx.$q.resolve( movie );

    return promise;
  }

{'fraction_non_alphanumeric': 0.0899929692992735, 'fraction_numerical': 0.07827513475509726, 'mean_word_length': 5.939837398373983, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4661023', 'n_tokens_mistral': 2395, 'n_tokens_neox': 2216, 'n_words': 172}