<commit_before>'use strict';

var app = app || {};

(function(module){

  var moviesModel = {};
  // This is the title inputs from the user
  moviesModel.movieInputs = [];
  //This is whats returned from the server
  moviesModel.movieData = [];
  //this is the selected movie
  moviesModel.movieSelection = {};

  moviesModel.selectMovie = function () {
    moviesModel.movieSelection = moviesModel.movieData.shift();
  }

  $('#submitInput').on('click', function(event) {
    event.preventDefault();
    //inputed from user in form
    app.moviesModel.movieInputs = $('.movieInput').val();

    app.moviesModel.movieQuery(app.resultsController.cycleResultsView);
    // app.resultsController.initResultsView();
  });

// ajax call to send inputed titles to server
  moviesModel.movieQuery = function (callback){
    $.ajax({
      url: `/search?titles=${moviesModel.movieInputs}`,
      method: 'GET',
    })
    .then(function (data) {
      moviesModel.movieData = data;
      moviesModel.selectMovie();
      callback(moviesModel.movieSelection);
      app.resultsController.initResultsView();
    });
  }
<commit_msg>Update movieModel.js<commit_after>'use strict';

var app = app || {};

(function(module){

  var moviesModel = {};
  // This is the title inputs from the user
  moviesModel.movieInputs = [];
  //This is whats returned from the server
  moviesModel.movieData = [];
  //this is the selected movie
  moviesModel.movieSelection = {};

  moviesModel.selectMovie = function () {
    moviesModel.movieSelection = moviesModel.movieData.shift();
  }

  $('#submitInput').on('click', function(event) {
    event.preventDefault();
    //inputed from user in form
    app.moviesModel.movieInputs = $('.movieInput').val();

    app.moviesModel.movieQuery(app.resultsController.cycleResultsView);
  });

// ajax call to send inputed titles to server
  moviesModel.movieQuery = function (callback){
    $.ajax({
      url: `/search?titles=${moviesModel.movieInputs}`,
      method: 'GET',
    })
    .then(function (data) {
      moviesModel.movieData = data;
      moviesModel.selectMovie();
      callback(moviesModel.movieSelection);
      app.resultsController.initResultsView();
    });
  }

{'fraction_non_alphanumeric': 0.1398093508851566, 'fraction_numerical': 0.0, 'mean_word_length': 3.507157464212679, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3850553', 'n_tokens_mistral': 667, 'n_tokens_neox': 650, 'n_words': 140}