function promiseForGettingRepos(startDate, endDate){
  return Repositories.getFromGithubForDateAndLanguage(startDate, 'javascript')
    .then(function(repos){
      debugger;
      Users.saveAllFromRepos(repos).then(function(userIds){
        debugger;
        Repositories.saveAll(userIds, repos).then(function(repoIds) {

          if(startDate.getDate() == endDate.getDate()) {
            return 'DONE';
          }else{
            startDate.setDate(startDate.getDate()+1);
            return promiseForGettingRepos(startDate, endDate);
          }

        }, _logErrorSaveRepo);
      }, _logErrorSaveUser);
    }, _logErrorGetRepo);
}
//gets repos from a starting date to a finish date
gets repos from a starting date to a finish date
gets repos from a starting date to a finish date
function promiseForGettingRepos(startDate, endDate){
  return Repositories.getFromGithubForDateAndLanguage(startDate, 'javascript')
    .then(function(repos){
      debugger;
      Users.saveAllFromRepos(repos).then(function(userIds){
        debugger;
        Repositories.saveAll(userIds, repos).then(function(repoIds) {
          if(startDate.getDate() == endDate.getDate()) {
            return 'DONE';
          }else{
            startDate.setDate(startDate.getDate()+1);
            return promiseForGettingRepos(startDate, endDate);
          }
        }, _logErrorSaveRepo);
      }, _logErrorSaveUser);
    }, _logErrorGetRepo);
}
function promiseForGettingRepos ( startDate , endDate ) { return Repositories . getFromGithubForDateAndLanguage ( startDate , 'javascript' ) . then ( function ( repos ) { debugger ; Users . saveAllFromRepos ( repos ) . then ( function ( userIds ) { debugger ; Repositories . saveAll ( userIds , repos ) . then ( function ( repoIds ) { if ( startDate . getDate ( ) == endDate . getDate ( ) ) { return 'DONE' ; } else { startDate . setDate ( startDate . getDate ( ) + 1 ) ; return promiseForGettingRepos ( startDate , endDate ) ; } } , _logErrorSaveRepo ) ; } , _logErrorSaveUser ) ; } , _logErrorGetRepo ) ; }
gets repos from a starting date to a finish date
gets repos from a starting date to a finish date