<commit_before>/*jslint todo: true, node: true, stupid: true, plusplus: true, continue: true */
"use strict";
var utils = {},
    spawn = require('child_process').spawn,
    mailer = require("./mailer"),
    config = require('./config');

utils.formatNodeInfo = function(node) {
  node.name = (node.name.toLowerCase() == 'diaspora*') ? node.host : node.name;
  var node_meta_tab = utils.get_node_network_and_version(node.network, node.version);
  node.network = node_meta_tab[0];
  node.version = node_meta_tab[1];
  node.registrations_open = (node.registrations_open) ? "Yes" : "No";
  if (node.active_users_halfyear == undefined) {
    node.active_users_halfyear = "-";
  }
  if (node.active_users_monthly == undefined) {
    node.active_users_monthly = "-";
  }
  if (node.total_users == undefined) {
    node.total_users = "-";
  }
  if (node.local_posts == undefined) {
    node.local_posts = "-";
  }
  if (node.local_comments == undefined) {
    node.local_comments = "-";
  }
  node.services = utils.services_string(node);
  return node;
}

utils.get_node_network_and_version = function(network, version) {
    /* Return an array that contains network and version
    by looking at network and version from node data. These are
    not always filled properly. */
    if (typeof network === 'undefined')
        network = 'unknown';<commit_msg>Display - instead of 0 in the nodes table<commit_after>/*jslint todo: true, node: true, stupid: true, plusplus: true, continue: true */
"use strict";
var utils = {},
    spawn = require('child_process').spawn,
    mailer = require("./mailer"),
    config = require('./config');

utils.formatNodeInfo = function(node) {
  node.name = (node.name.toLowerCase() == 'diaspora*') ? node.host : node.name;
  var node_meta_tab = utils.get_node_network_and_version(node.network, node.version);
  node.network = node_meta_tab[0];
  node.version = node_meta_tab[1];
  node.registrations_open = (node.registrations_open) ? "Yes" : "No";
  if (node.active_users_halfyear == undefined || node.active_users_halfyear == 0) {
    node.active_users_halfyear = "-";
  }
  if (node.active_users_monthly == undefined || node.active_users_monthly == 0) {
    node.active_users_monthly = "-";
  }
  if (node.total_users == undefined || node.total_users == 0) {
    node.total_users = "-";
  }
  if (node.local_posts == undefined || node.local_posts == 0) {
    node.local_posts = "-";
  }
  if (node.local_comments == undefined || node.local_comments == 0) {
    node.local_comments = "-";
  }
  node.services = utils.services_string(node);
  return node;
}

utils.get_node_network_and_version = function(network, version) {
    /* Return an array that contains network and version
    by looking at network and version from node data. These are
    not always filled properly. */
    if (typeof network === 'undefined')
        network = 'unknown';
{'fraction_non_alphanumeric': 0.1445950643030935, 'fraction_numerical': 0.003475842891901286, 'mean_word_length': 3.8369747899159665, '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': '51060', 'n_tokens_mistral': 933, 'n_tokens_neox': 936, 'n_words': 208}