<commit_before>// TODO:
// - bypass nightmode in reports
// - get rid of /static/report/js/time.js
// - load css dynamic + optimize
// - add tests
// - on save/delete treatment ctx.bus.emit('data-received'); is not enough. we must add something like 'data-updated'

(function () {
  'use strict';
  //for the tests window isn't the global object
  var $ = window.$;
  var moment = window.moment;
  var Nightscout = window.Nightscout;
  var client = Nightscout.client;
  var report_plugins = Nightscout.report_plugins;

  if (serverSettings === undefined) {
    console.error('server settings were not loaded, will not call init');
  } else {
    client.init(serverSettings, Nightscout.plugins);
  }
 
  // init HTML code
  report_plugins.addHtmlFromPlugins( client );
  // make show() accessible outside for treatments.js
  report_plugins.show = show;
  
  var translate = client.translate;
  
  var maxInsulinValue = 0
      ,maxCarbsValue = 0;
  var maxdays = 3 * 31;
  var datastorage = {};
  var daystoshow = {};
  
  var targetBGdefault = {
    'mg/dl': { low: 72, high: 180 },
    'mmol': { low: 4, high: 10 }
  };
  
  var ONE_MIN_IN_MS = 60000;
  
  prepareGUI();

  // ****** FOOD CODE START ******
  var food_categories = [];
  var food_list = [];
  
  var filter = {
      category: ''
    , subcategory: ''
    , name: ''
  };

  function fillFoodForm(event) {
    $('#rp_category').empty().append(new Option(translate('(none)'),''));
    for (var s in food_categories) {
      $('#rp_category').append(new Option(s,s));
    }
    filter.category = '';
    fillFoodSubcategories();
    
    $('#rp_category').change(fillFoodSubcategories);
    $('#rp_subcategory').change(doFoodFilter);<commit_msg>get thresholds from settings<commit_after>// TODO:
// - bypass nightmode in reports
// - get rid of /static/report/js/time.js
// - load css dynamic + optimize
// - add tests
// - on save/delete treatment ctx.bus.emit('data-received'); is not enough. we must add something like 'data-updated'

(function () {
  'use strict';
  //for the tests window isn't the global object
  var $ = window.$;
  var moment = window.moment;
  var Nightscout = window.Nightscout;
  var client = Nightscout.client;
  var report_plugins = Nightscout.report_plugins;

  if (serverSettings === undefined) {
    console.error('server settings were not loaded, will not call init');
  } else {
    client.init(serverSettings, Nightscout.plugins);
  }
 
  // init HTML code
  report_plugins.addHtmlFromPlugins( client );
  // make show() accessible outside for treatments.js
  report_plugins.show = show;
  
  var translate = client.translate;
  
  var maxInsulinValue = 0
      ,maxCarbsValue = 0;
  var maxdays = 3 * 31;
  var datastorage = {};
  var daystoshow = {};
  
  var targetBGdefault = {
    'mg/dl': {
      low: client.settings.thresholds.bgTargetBottom
      , high: client.settings.thresholds.bgTargetTop
    }
    , 'mmol': {
      low: client.utils.scaleMgdl(client.settings.thresholds.bgTargetBottom)
      , high: client.utils.scaleMgdl(client.settings.thresholds.bgTargetTop)
    }
  };
  
  var ONE_MIN_IN_MS = 60000;
  
  prepareGUI();

  // ****** FOOD CODE START ******
  var food_categories = [];
  var food_list = [];
  
  var filter = {
      category: ''
    , subcategory: ''
    , name: ''
  };

  function fillFoodForm(event) {
    $('#rp_category').empty().append(new Option(translate('(none)'),''));
    for (var s in food_categories) {
      $('#rp_category').append(new Option(s,s));
    }
    filter.category = '';
    fillFoodSubcategories();
    
    $('#rp_category').change(fillFoodSubcategories);
    $('#rp_subcategory').change(doFoodFilter);
{'fraction_non_alphanumeric': 0.14558342420937842, 'fraction_numerical': 0.007633587786259542, 'mean_word_length': 3.12710911136108, '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': '2821390', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1158, 'n_words': 284}