<commit_before>RealTeam.CurrentuserController = Ember.ObjectController.extend({
  //templateName: 'currentuser',
  init: function(){
    console.log('init CurrentuserController');
    console.log("this : ", this);
    console.log("this.content : ", this.content);
    console.log("this.model : ", this.model);
    console.log("RealTeam.currentuser : ", RealTeam.currentuser);
  },
  updateCurrentIssue: function (issue) {
    RealTeam.currentuser.set('currentIssue', issue);
  },
  runTimer: function(){
    RealTeam.currentuser.set('currentTimerId', setInterval(function(){
      var currentTimer = RealTeam.currentuser.get('currentIssue.currentTimer');
      RealTeam.currentuser.set('currentIssue.currentTimer', currentTimer + 1000);
    }, 1000));
  },
  pauseTimer: function(){
    clearInterval(RealTeam.currentuser.get('currentTimerId'));
  },
  stopTimer: function(){
    RealTeam.currentuser.set('currentIssue.currentTimer', - 60 * 60 * 1000);
    clearInterval(RealTeam.currentuser.get('currentTimerId'));
  },
  start: function(issue){
    //clearInterval(RealTeam.get('currentIntervalId'));
    //RealTeam.currentuser.set('currentIssue', issue);
    RealTeam.socket.emit('startIssue', issue.id, function (err, issue) {
      console.log("startIssue : ", issue);
      RealTeam.currentuserController.updateCurrentIssue(issue);
      //RealTeam.currentuserController.stopTimer();
      RealTeam.currentuser.set('currentIssue.currentTimer', - 60 * 60 * 1000);
      RealTeam.currentuserController.runTimer();
    });
  },
  pause: function(){
    //clearInterval(RealTeam.get('currentIntervalId'));
    //RealTeam.currentuser.set('currentIssue', issue);
    console.log("pause currentuser : ");
    //RealTeam.currentuser.set('currentIssue', issue);
    RealTeam.socket.emit('pauseIssue', function (err, issue) {
      console.log("pauseIssue : ", issue);
      RealTeam.currentuserController.updateCurrentIssue(issue);
      if (issue.paused) {
        RealTeam.currentuserController.pauseTimer();
      }
      else {
        RealTeam.currentuserController.runTimer();
      }
    });
  },
  stop: function(){
    //clearInterval(RealTeam.get('currentIntervalId'));
    RealTeam.socket.emit('stopIssue', function (err, issue) {
      console.log("stopIssue : ", issue);
      RealTeam.currentuser.set('hasAddtime', true);
      issue.seconds = issue.pendingDuration / 1000;
      issue.minutes = Math.round(issue.seconds / 60);
      issue.hours = Math.floor(issue.minutes / 60);
      issue.minutes = issue.minutes - issue.hours * 60;
      console.log("stop currentuser : ", issue);

      RealTeam.currentuserController.updateCurrentIssue(issue);<commit_msg>ember: use events to manage start issue<commit_after>RealTeam.CurrentuserController = Ember.ObjectController.extend({
  //templateName: 'currentuser',
  init: function(){
    console.log('init CurrentuserController');
    console.log("this : ", this);
    console.log("this.content : ", this.content);
    console.log("this.model : ", this.model);
    console.log("RealTeam.currentuser : ", RealTeam.currentuser);
  },
  updateCurrentIssue: function (issue) {
    RealTeam.currentuser.set('currentIssue', issue);
  },
  runTimer: function(){
    RealTeam.currentuser.set('currentTimerId', setInterval(function(){
      var currentTimer = RealTeam.currentuser.get('currentIssue.currentTimer');
      RealTeam.currentuser.set('currentIssue.currentTimer', currentTimer + 1000);
    }, 1000));
  },
  pauseTimer: function(){
    clearInterval(RealTeam.currentuser.get('currentTimerId'));
  },
  stopTimer: function(){
    RealTeam.currentuser.set('currentIssue.currentTimer', - 60 * 60 * 1000);
    clearInterval(RealTeam.currentuser.get('currentTimerId'));
  },
  start: function(issue){
    //clearInterval(RealTeam.get('currentIntervalId'));
    //RealTeam.currentuser.set('currentIssue', issue);
    RealTeam.socket.emit('startIssue', issue.id, function (err, issue) {
      //console.log("startIssue : ", issue);
      //RealTeam.currentuserController.updateCurrentIssue(issue);
      ////RealTeam.currentuserController.stopTimer();
      //RealTeam.currentuser.set('currentIssue.currentTimer', - 60 * 60 * 1000);
      //RealTeam.currentuserController.runTimer();
    });
  },
  pause: function(){
    //clearInterval(RealTeam.get('currentIntervalId'));
    //RealTeam.currentuser.set('currentIssue', issue);
    console.log("pause currentuser : ");
    //RealTeam.currentuser.set('currentIssue', issue);
    RealTeam.socket.emit('pauseIssue', function (err, issue) {
      console.log("pauseIssue : ", issue);
      RealTeam.currentuserController.updateCurrentIssue(issue);
      if (issue.paused) {
        RealTeam.currentuserController.pauseTimer();
      }
      else {
        RealTeam.currentuserController.runTimer();
      }
    });
  },
  stop: function(){
    //clearInterval(RealTeam.get('currentIntervalId'));
    RealTeam.socket.emit('stopIssue', function (err, issue) {
      console.log("stopIssue : ", issue);
      RealTeam.currentuser.set('hasAddtime', true);
      issue.seconds = issue.pendingDuration / 1000;
      issue.minutes = Math.round(issue.seconds / 60);
      issue.hours = Math.floor(issue.minutes / 60);
      issue.minutes = issue.minutes - issue.hours * 60;
      console.log("stop currentuser : ", issue);

      RealTeam.currentuserController.updateCurrentIssue(issue);
{'fraction_non_alphanumeric': 0.1529739776951673, 'fraction_numerical': 0.012639405204460967, 'mean_word_length': 3.9503219871205153, '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': '2888752', 'n_tokens_mistral': 1641, 'n_tokens_neox': 1519, 'n_words': 225}