<commit_before>submissionString = "<<NAME>>[Gangs of New York] -> <<NAME>>[Lincoln] -> <<NAME>>[<NAME>] -> <<NAME>>[Apollo 13]"
$("div.results h4.submission-string").text(submissionString)
actorList = submissionString.split(" -> ")
movies = {}

#Get all movie data
for actor in actorList
  [_,actorName,actorMovie] = /^<(.*?)>\[(.*?)\]$/.exec(actor)
  movies[actorMovie] = actorName

allMovieData = []

passed = true
$.each Object.keys(movies), (index, movieName) ->
  $.getJSON "https://codechallenge.orasi.com/movies?callback=?",
  {search: movieName},
  (data) ->
    actorName = movies[movieName]
    nextActor = movies[Object.keys(movies)[index+1]]
    console.log("#{movieName} #{index}")
    if typeof(nextActor) == "undefined"
      nextActor = "<NAME>"
    scenarioPass = (data.actors.indexOf(actorName) >= 0) && #The actor specified is in the movie.
    (data.actors.indexOf(nextActor) >= 0)  #The next actor is in the movie.
    allMovieData[index] = {name: movieName, poster: data.poster, pass: scenarioPass, actors: [actorName,nextActor]}
    return passed = passed && scenarioPass

showMovie = (movieData) ->
  movieObj = $("<div class='movie'></div>").appendTo("div.results")
  $("<img src class='movie-poster' id='#{movieData.name}'>").appendTo(movieObj)
  for actor in movieData.actors
    $("<span class='actor-name'>#{actor}</span>").appendTo(movieObj);
  $("div.results .movie:last-child > img").attr("src", movieData.poster);
  if not movieData.pass
    movieObj.css("border", "2px solid red")

$(document).ajaxStop ->
  msg = $("div.results > h4.msg")
  if passed
    msg.addClass("pass")
    msg.text("Passed")
  else
    msg.addClass("fail")
    msg.text("Failed")

  for movie in allMovieData
    showMovie(movie)

  $("div.results > div.loader").hide();
<commit_msg>Checking issue with coffeescript<commit_after>submissionString = "<<NAME>>[Gangs of New York] -> <<NAME>>[Lincoln] -> <<NAME>>[Forrest Gump] -> <<NAME>>[Apollo 13]"
$("div.results h4.submission-string").text(submissionString)
actorList = submissionString.split(" -> ")
movies = {}

#Get all movie data
for actor in actorList
  [_,actorName,actorMovie] = /^<(.*?)>\[(.*?)\]$/.exec(actor)
  movies[actorMovie] = actorName

allMovieData = []

passed = true
$.each Object.keys(movies), (index, movieName) ->
  $.getJSON "https://codechallenge.orasi.com/movies?callback=?",
  {search: movieName},
  (data) ->
    actorName = movies[movieName]
    nextActor = movies[Object.keys(movies)[index+1]]
    console.log("#{movieName} #{index}")
    if typeof(nextActor) == "undefined"
      nextActor = "<NAME>"
    scenarioPass = (data.actors.indexOf(actorName) >= 0) && #The actor specified is in the movie.
    (data.actors.indexOf(nextActor) >= 0)  #The next actor is in the movie.
    allMovieData[index] = {name: movieName, poster: data.poster, pass: scenarioPass, actors: [actorName,nextActor]}
    console.log(allMovieData)
    return passed = passed && scenarioPass

showMovie = (movieData) ->
  movieObj = $("<div class='movie'></div>").appendTo("div.results")
  $("<img src class='movie-poster' id='#{movieData.name}'>").appendTo(movieObj)
  for actor in movieData.actors
    $("<span class='actor-name'>#{actor}</span>").appendTo(movieObj);
  $("div.results .movie:last-child > img").attr("src", movieData.poster);
  if not movieData.pass
    movieObj.css("border", "2px solid red")

$(document).ajaxStop ->
  msg = $("div.results > h4.msg")
  if passed
    msg.addClass("pass")
    msg.text("Passed")
  else
    msg.addClass("fail")
    msg.text("Failed")

  for movie in allMovieData
    showMovie(movie)

  $("div.results > div.loader").hide();

{'fraction_non_alphanumeric': 0.19208573784006594, 'fraction_numerical': 0.004396812311074471, 'mean_word_length': 4.457271364317841, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 60, 'https://': 2, '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': '4611928', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1221, 'n_words': 255}