<commit_before>import angular from 'angular';
import uiRouter from 'angular-ui-router';
import routing from './overview.routes';

function updateThrottleBrake(throttle,brake) {
  if(throttle)
  {
    angular.element(document.querySelector('#throttle-bar')).html(Math.round(throttle / 0x7FF * 100) + "%");
    document.getElementById("throttle-bar").style.height = (400 * throttle) / 0x7FF + "px";
  }
  if(brake)
  {
    angular.element(document.querySelector('#brake-bar')).html(Math.round(brake / 0x7FF) + "%");
    document.getElementById("brake-bar").style.height = (400 * brake) / 0x7FF + "px";
  }
}

function updateTemperatures($scope,temp) {
  var arrayLength = temp.temp_array.length;
  for (var i = 0; i < arrayLength; i++) {
    angular.element(document.querySelector('#t'+ i)).html(temp.temp_array[i]+"&degC");
    if(temp.temp_array[i]>150) temp.temp_array[i] = 150;
    document.getElementById("t"+i).style.backgroundColor = "hsl(" + (120 - (temp.temp_array[i]/150*120)) +", 75%, 50%)"
  }

}

function updateStates(bms,car)
{
  if(bms){
    angular.element(document.querySelector('#bms-state')).html("BMS State: " + bms.flag);
  }
  if(car) {
    angular.element(document.querySelector('#car-state')).html("Car State: " + car.flag);
  }
}


export class OverviewController {
  /*@ngInject*/
  constructor($scope, socket) {
    this.socket = socket;
    this.scope = $scope;
    $scope.$on('$destroy', function () {
      socket.unsyncUpdates('car');
    });
    $scope.$on('$destroy', function () {
      socket.unsyncUpdates('temp');
    });
    $scope.$on('$destroy', function () {
      socket.unsyncUpdates('bms');
    });
  }

  $onInit() {
    this.socket.syncUpdates('car', function (data) {
      if (data) {<commit_msg>fixed state<commit_after>import angular from 'angular';
import uiRouter from 'angular-ui-router';
import routing from './overview.routes';

function updateThrottleBrake(throttle,brake) {
  if(throttle)
  {
    angular.element(document.querySelector('#throttle-bar')).html(Math.round(throttle / 0x7FF * 100) + "%");
    document.getElementById("throttle-bar").style.height = (400 * throttle) / 0x7FF + "px";
  }
  if(brake)
  {
    angular.element(document.querySelector('#brake-bar')).html(Math.round(brake / 0x7FF) + "%");
    document.getElementById("brake-bar").style.height = (400 * brake) / 0x7FF + "px";
  }
}

function updateTemperatures($scope,temp) {
  var arrayLength = temp.temp_array.length;
  for (var i = 0; i < arrayLength; i++) {
    angular.element(document.querySelector('#t'+ i)).html(temp.temp_array[i]+"&degC");
    if(temp.temp_array[i]>150) temp.temp_array[i] = 150;
    document.getElementById("t"+i).style.backgroundColor = "hsl(" + (120 - (temp.temp_array[i]/150*120)) +", 75%, 50%)"
  }

}

function updateStates(bms,car)
{
  if(bms){
    angular.element(document.querySelector('#bms-state')).html("BMS State: " + bms.flag);
  }
  if(car) {
    angular.element(document.querySelector('#car-state')).html("Car State: " + car.state);
  }
}


export class OverviewController {
  /*@ngInject*/
  constructor($scope, socket) {
    this.socket = socket;
    this.scope = $scope;
    $scope.$on('$destroy', function () {
      socket.unsyncUpdates('car');
    });
    $scope.$on('$destroy', function () {
      socket.unsyncUpdates('temp');
    });
    $scope.$on('$destroy', function () {
      socket.unsyncUpdates('bms');
    });
  }

  $onInit() {
    this.socket.syncUpdates('car', function (data) {
      if (data) {
{'fraction_non_alphanumeric': 0.193974175035868, 'fraction_numerical': 0.021233859397417502, 'mean_word_length': 4.008620689655173, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5030300', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1225, 'n_words': 179}