<commit_before>var firebase = require('firebase');
var $ = require('jquery');

module.exports = function(Auth, redirect) {
  return function () {
    var userId = firebase.auth().currentUser.uid;

    // Get a reference to the database service
    var markup = '';
    var database = firebase.database();
    var query = firebase.database().ref("movies").limitToFirst(20);
    query.once("value")
      .then(function(snapshot) {
        snapshot.forEach(renderSingleSnapshot);
      }).then(function(){
        $(document).find('#list').html(markup);
      });

    var renderSingleSnapshot = function(childSnapshot) {
      var movie = childSnapshot.val();
      console.log(movie)
      var html = '';
      html += '<li class="list-group-item movie"> \
        <div>';
        if( movie.imdbUrl === '' ){
          html += '<h5>'+  movie.movieName +'</h5>';
        } else {
          html += '<h5>'+ '<a href="'+movie.imdbUrl+'" target="_blank">'+movie.movieName+'</a>' +'</h5>';

        }
        html += '<h6><b>Director: </b>'+movie.directors.join(', ')+'</h6>\
          <small><b>Released in: </b>'+(movie.releaseYear)+'<br/>\
          <b>Duration: </b>'+durationConvertor(movie.duration)+'<br/>\
          <b>Actors: </b>';
      html += (movie.actors || movie.stars).join(', ')
                    +'</small>';
      html += '</div>\
              </li>';
      markup += html;
    }

    var durationConvertor = function(minutes){
      if(typeof minutes === 'string'){
        minutes = Number(minutes);
      }
      var hours = parseInt( minutes/60, 10 );
      var mins = minutes%60;
      return hours+'hr '+mins+'min';
    }
  }
}
<commit_msg>formating ListController<commit_after>var firebase = require('firebase');
var $ = require('jquery');

var ListController = function(Auth, redirect) {
  return function () {
    var userId = firebase.auth().currentUser.uid;

    // Get a reference to the database service
    var markup = '';
    var database = firebase.database();
    var query = firebase.database().ref("movies").limitToFirst(20);
    query.once("value")
      .then(function(snapshot) {
        snapshot.forEach(renderSingleSnapshot);
      }).then(function(){
        $(document).find('#list').html(markup);
      });

    var renderSingleSnapshot = function(childSnapshot) {
      var movie = childSnapshot.val();

      var html = '';

      html += '<li class="list-group-item movie">';
        html += '<div>';
        if( movie.imdbUrl === '' ){
          html += '<h5>'+  movie.movieName +'</h5>';
        } else {
          html += '<h5>'+ '<a href="'+movie.imdbUrl+'" target="_blank">'+movie.movieName+'</a>' +'</h5>';
        }
        html += '<h6><b>Director: </b>'+movie.directors.join(', ')+'</h6>';
        html += '<small><b>Released in: </b>'+(movie.releaseYear)+'<br/>';
        html += '<b>Duration: </b>'+durationConvertor(movie.duration)+'<br/>';
        html += '<b>Actors: </b>';
        html += (movie.actors || movie.stars).join(', ') + '</small>';
        html += '</div>';
      html += '</li>';

      markup += html;
    }

    var durationConvertor = function(minutes){
      if(typeof minutes === 'string'){
        minutes = Number(minutes);
      }
      var hours = parseInt( minutes/60, 10 );
      var mins = minutes%60;
      return hours+'hr '+mins+'min';
    }
  }
}

ListController.toggleStar = function(movieUniqueId){
  console.log(movieUniqueId);
}

module.exports = ListController;

{'fraction_non_alphanumeric': 0.20028901734104046, 'fraction_numerical': 0.008092485549132947, 'mean_word_length': 2.6278825995807127, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, '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': '7119627', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1069, 'n_words': 209}