<commit_before>/*jslint browser: true, white: true, plusplus: true, eqeq: true, es5: true*/
/*global angular, console, alert, squel*/

(function () {
  'use strict';

  var app = angular.module('keira2');

  app.globalQueryConfig = {
    replaceSingleQuotes : true,
    singleQuoteReplacement : "\\'",
    autoQuoteTableNames: true,
    autoQuoteFieldNames: true
  };

  /* [Function] cleanRows
   * prepare rows to query generation
   */
  app.cleanRows = function(rows) {
    var cleanedRows, i, key;

    /* Here we need to remove the $$hashKey field from all newRows objects
     * because we don't want it inside our query
     * if we remove $$hashKey field directly from newRows objects we will break the DOM
     * then we create a copy of newRows without that field
     * clearedNewRows will be the copy of newRows objects without the $$hashKey field */
    cleanedRows = angular.fromJson(angular.toJson(rows));

    // Convert numeric values
    for (i = 0; i < cleanedRows.length; i++) {
      for (key in cleanedRows[i]) {
        if (cleanedRows[i].hasOwnProperty(key)) {
          if (!isNaN(cleanedRows[i][key]) && cleanedRows[i][key] != "") {
            cleanedRows[i][key] = Number(cleanedRows[i][key]);
          }
        }
      }
    }

    return cleanedRows;
  };

  /* [Function] getUpdateQuery
   *  Description: Tracks difference between two row objects and generate UPDATE query
   *  Inputs:
   *  - tableName -> the name of the table (example: "creature_template")
   *  - whereCondition -> the WHERE condition (example: "entry = 30")
   *  - currentRow -> object of the original table
   *  - newRow -> object bound with ng-model to view
   */
  app.getUpdateQuery = function(tableName, whereCondition, currentRow, newRow) {

    var key,
        diff = false,
        query = squel.update(app.globalQueryConfig);

    query.table(tableName);

    for (key in currentRow) {
      if (currentRow[key] !== newRow[key]) {

        // Convert numeric values<commit_msg>Fix DIFF code generation of all *_loot_template<commit_after>/*jslint browser: true, white: true, plusplus: true, eqeq: true, es5: true*/
/*global angular, console, alert, squel*/

(function () {
  'use strict';

  var app = angular.module('keira2');

  app.globalQueryConfig = {
    replaceSingleQuotes : true,
    singleQuoteReplacement : "\\'",
    autoQuoteTableNames: true,
    autoQuoteFieldNames: true
  };

  /* [Function] cleanRows
   * prepare rows to query generation
   */
  app.cleanRows = function(rows) {
    var cleanedRows, i, key;

    /* Here we need to remove the $$hashKey field from all newRows objects
     * because we don't want it inside our query
     * if we remove $$hashKey field directly from newRows objects we will break the DOM
     * then we create a copy of newRows without that field
     * clearedNewRows will be the copy of newRows objects without the $$hashKey field */
    cleanedRows = angular.fromJson(angular.toJson(rows));

    // Convert numeric values
    for (i = 0; i < cleanedRows.length; i++) {
      for (key in cleanedRows[i]) {
        if (cleanedRows[i].hasOwnProperty(key)) {
          if (!isNaN(cleanedRows[i][key]) && cleanedRows[i][key] != null && cleanedRows[i][key] != "") {
            cleanedRows[i][key] = Number(cleanedRows[i][key]);
          }
        }
      }
    }

    return cleanedRows;
  };

  /* [Function] getUpdateQuery
   *  Description: Tracks difference between two row objects and generate UPDATE query
   *  Inputs:
   *  - tableName -> the name of the table (example: "creature_template")
   *  - whereCondition -> the WHERE condition (example: "entry = 30")
   *  - currentRow -> object of the original table
   *  - newRow -> object bound with ng-model to view
   */
  app.getUpdateQuery = function(tableName, whereCondition, currentRow, newRow) {

    var key,
        diff = false,
        query = squel.update(app.globalQueryConfig);

    query.table(tableName);

    for (key in currentRow) {
      if (currentRow[key] !== newRow[key]) {

        // Convert numeric values
{'fraction_non_alphanumeric': 0.11554570091155457, 'fraction_numerical': 0.002463661000246366, 'mean_word_length': 2.9151398264223722, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4961504', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1183, 'n_words': 381}