<commit_before>"use strict";

var $ = require('jquery');

var TrainExplorerConstants = require('../constants/TrainExplorerConstants');

var TrainExplorerActions = {
  loadTrainExplorer: function(fromCrs, toCrs, typeOfDays, time) {
    if (fromCrs === undefined && toCrs === undefined) {
      this.dispatch(TrainExplorerConstants.LOAD);
      return;
    }
    this.dispatch(TrainExplorerConstants.LOAD);
    console.log("Starting request to API server.");
    $.ajax({
      url: "http://odidemo.fstr.uk:5000/TrainExplorer/" + fromCrs + "/" + toCrs + "/" + typeOfDays + "/" + time,
      //url: "/data.json",
      dataType: 'json',
      cache: false,
      success: function(data) {
        this.dispatch(TrainExplorerConstants.LOAD_SUCCESS, data);
      }.bind(this),
      error: function(xhr, status, err) {
        console.error(status, err.toString());
        this.dispatch(TrainExplorerConstants.LOAD_FAIL, {error: err});
      }.bind(this)
    });
  },
  loadCallingPoints: function(trainID) {
    if (trainID === null) {
      this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD_SUCCESS, { train: null, callingPoints: [] });
      return;
    }
    var trainIDCode = trainID[0];
    var origin = trainID[1];
    var dest = trainID[2];
    console.log("this.dispatch(TrainExplorerConstants.LOAD_CALLING_POINTS);");
    this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD, trainIDCode);
    console.log("Starting request to API server for calling points.");
    $.ajax({
      url: "http://odidemo.fstr.uk:5000/CallingPoints/" + origin + "/" + dest + "/" + trainIDCode,
      dataType: 'json',
      cache: false,
      success: function(data) {
        data[trainIDCode].train = trainIDCode;
        this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD_SUCCESS, data[trainIDCode]);
      }.bind(this),
      error: function(xhr, status, err) {
        console.error(status, err.toString());
        this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD_FAIL, {error: err});
      }.bind(this)
    });
  },
  updateRoute: function(routeID) {
    this.dispatch(TrainExplorerConstants.UPDATE_ROUTE, routeID);
  }
};

module.exports = TrainExplorerActions;<commit_msg>Localised feed location<commit_after>"use strict";

var $ = require('jquery');

var TrainExplorerConstants = require('../constants/TrainExplorerConstants');

var TrainExplorerActions = {
  loadTrainExplorer: function(fromCrs, toCrs, typeOfDays, time) {
    if (fromCrs === undefined && toCrs === undefined) {
      this.dispatch(TrainExplorerConstants.LOAD);
      return;
    }
    this.dispatch(TrainExplorerConstants.LOAD);
    console.log("Starting request to API server.");
    $.ajax({
      url: "http://localhost:5000/TrainExplorer/" + fromCrs + "/" + toCrs + "/" + typeOfDays + "/" + time,
      //url: "/data.json",
      dataType: 'json',
      cache: false,
      success: function(data) {
        this.dispatch(TrainExplorerConstants.LOAD_SUCCESS, data);
      }.bind(this),
      error: function(xhr, status, err) {
        console.error(status, err.toString());
        this.dispatch(TrainExplorerConstants.LOAD_FAIL, {error: err});
      }.bind(this)
    });
  },
  loadCallingPoints: function(trainID) {
    if (trainID === null) {
      this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD_SUCCESS, { train: null, callingPoints: [] });
      return;
    }
    var trainIDCode = trainID[0];
    var origin = trainID[1];
    var dest = trainID[2];
    console.log("this.dispatch(TrainExplorerConstants.LOAD_CALLING_POINTS);");
    this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD, trainIDCode);
    console.log("Starting request to API server for calling points.");
    $.ajax({
      url: "http://localhost:5000/CallingPoints/" + origin + "/" + dest + "/" + trainIDCode,
      dataType: 'json',
      cache: false,
      success: function(data) {
        data[trainIDCode].train = trainIDCode;
        this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD_SUCCESS, data[trainIDCode]);
      }.bind(this),
      error: function(xhr, status, err) {
        console.error(status, err.toString());
        this.dispatch(TrainExplorerConstants.CALLING_POINTS_LOAD_FAIL, {error: err});
      }.bind(this)
    });
  },
  updateRoute: function(routeID) {
    this.dispatch(TrainExplorerConstants.UPDATE_ROUTE, routeID);
  }
};

module.exports = TrainExplorerActions;
{'fraction_non_alphanumeric': 0.14468279324509356, 'fraction_numerical': 0.005020538566864446, 'mean_word_length': 3.5325749741468457, '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': '1198913', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1360, 'n_words': 237}