<commit_before>'use strict';

var Reflux = require('reflux');
var actions = require('../actions/actions');
var store = require('store');
var xhr = require('xhr');
var taskObj = require('../mixins/task-item');
var config = require('../config');

module.exports = Reflux.createStore({
  data: {},

  init: function() {
    this.data = {
      key: '',
      value: {},
      mapData: [],
      baseLayer: store.get('baseLayer') ? store.get('baseLayer') : null
    };
    this.listenTo(actions.taskData, this.taskData);
    this.listenTo(actions.taskDone, this.taskDone);
    this.listenTo(actions.baseLayerChange, this.baseLayerChange);
  },

  getInitialState: function() {
    return this.data;
  },

  taskDone: function(task) {
    var _this = this;
    var querystring = '?error=' + task;
    this.postToTaskServer('fixed/' + querystring, {
      user: store.get('username'),
      state: this.data.value
    }, function(err, res) {
      if (err) return console.error(err);
        _this.taskData(task);
    });
  },

  taskData: function(task) {
    task = taskObj(task);
    var _this = this;

    // Clear out what mapData there is
    this.data.mapData = [];

    this.postToTaskServer('error/' + task.id, {
      user: store.get('username')
    }, function(err, res) {
      if (err) return console.error(err);
      _this.data.key = res.key;
      _this.data.value = res.value;

      switch (task.source) {
        case 'keepright':
          _this.fetchKeepRight(function(err, res) {
            if (err) return console.error(err);
            _this.trigger(_this.data);
          });
        break;
        case 'unconnected':
          _this.fetchUnconnected(function(err, res) {
            if (err) return console.error(err);
            _this.trigger(_this.data);
          });
        break;
      }
    });
  },
<commit_msg>Try the next item if node or way are missing for current item<commit_after>'use strict';

var Reflux = require('reflux');
var actions = require('../actions/actions');
var store = require('store');
var xhr = require('xhr');
var taskObj = require('../mixins/task-item');
var config = require('../config');

module.exports = Reflux.createStore({
  data: {},

  init: function() {
    this.data = {
      key: '',
      value: {},
      mapData: [],
      baseLayer: store.get('baseLayer') ? store.get('baseLayer') : null
    };
    this.listenTo(actions.taskData, this.taskData);
    this.listenTo(actions.taskDone, this.taskDone);
    this.listenTo(actions.baseLayerChange, this.baseLayerChange);
  },

  getInitialState: function() {
    return this.data;
  },

  taskDone: function(task) {
    var _this = this;
    var querystring = '?error=' + task;
    this.postToTaskServer('fixed/' + querystring, {
      user: store.get('username'),
      state: this.data.value
    }, function(err, res) {
      if (err) return console.error(err);
        _this.taskData(task);
    });
  },

  taskData: function(task) {
    task = taskObj(task);
    var _this = this;

    // Clear out what mapData there is
    this.data.mapData = [];

    this.postToTaskServer('error/' + task.id, {
      user: store.get('username')
    }, function(err, res) {
      if (err) return console.error(err);
      _this.data.key = res.key;
      _this.data.value = res.value;

      switch (task.source) {
        case 'keepright':
          _this.fetchKeepRight(function(err, res) {
            if (err) return console.error(err);
            _this.trigger(_this.data);
          });
        break;
        case 'unconnected':
          _this.fetchUnconnected(function(err, res) {
            if (err) {
              _this.taskData(task);
              return console.error(err);
            }
            _this.trigger(_this.data);
          });
        break;
      }
    });
  },

{'fraction_non_alphanumeric': 0.15578947368421053, 'fraction_numerical': 0.0, 'mean_word_length': 2.4150943396226414, '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': '2594696', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1182, 'n_words': 243}