<commit_before>doctype
html
  head
    meta(charset='utf-8')
    meta(http-equiv='X-UA-Compatible', content='IE=edge')
    title Dashboard
    meta(name='description', content='')
    meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
    link(rel="stylesheet", href="/style.css")

    script(type="text/javascript", src="/templates.js")
    script(type="text/javascript", src="/app.js")

  body
    nav.navbar.navbar-full.navbar-dark.bg-inverse
      button.navbar-toggler.hidden-sm-up(type="button", data-toggle="collapse", data-target="#navbar", aria-expanded="false", aria-controls="navbar")
        span.sr-only Toggle Navigation
        span.icon-bar
        span.icon-bar
        span.icon-bar
      
      a.navbar-brand(href="index.html") LOGO
      
      div#navbar
        nav.nav.navbar-nav.pull-right
          a.nav-item.nav-link(href="map.html") Map
          a.nav-item.nav-link(href="settings.html") Settings

    div#content.container
      div.row.card
        div#thing-info.col-sm-8.card-block
          h1.page-header Loading&hellip;
        
          dl
            dt Description
            dd Loading&hellip;
          
        div#small-map-container.col-sm-4
          div#map
          
      div.row
        div.col-sm-3.card-block
          h4 Time Range
        div.col-sm-9.card-block
          h5.pull-xs-right
            a(href="#")
              time May 1 2016 00:00:00 UTC
              | &nbsp;
              i.fa.fa-calendar
            wbr
            | &nbsp;to&nbsp;
            wbr
            a(href="#")
              time May 2 2016 00:00:00 UTC
              | &nbsp;
              i.fa.fa-calendar            
          
      div#datastreams
          
    script(type="text/javascript").
      $(function() {
        // Update query params in URL, get SensorThings URL from query params
        // or from LocalStorage.
        ParamsController.activate();
        var ST = new SensorThings(ParamsController.get("stURL"));
        
        var Thing = ST.getThing(ParamsController.get("id"), {
          data: {
            "$expand": "Locations"
          }
        });
        
        // Map
        
        L.Icon.Default.imagePath = "/images";
        
        var map = L.map('map', {
          dragging: false,
          touchZoom: false,
          scrollWheelZoom: false,
          doubleClickZoom: false,
          boxZoom: false,
          keyboard: false,
          zoomControl: false
        }).setView([51.049, -114.08], 13);

        L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
        }).addTo(map);
        
        // Data Load Handler
        Q(Thing).then(function(thing) {
          // Load Metadata
          var properties = $.extend({}, thing.attributes, {
            locationDescription: thing.locations[0].get("description")
          });
          var template = JST["thing-info"](properties);
          $("#thing-info").html(template);
          
          // Load feature marker
          Q(thing.locations)
          .then(function(locations) {
            var location = locations[0];
            if (location && location.get("location")) {
              // Generate HTML for popup
              var properties = $.extend({}, thing.attributes, { 
                stURL: encodeURIComponent(ParamsController.get("stURL"))
              });
              var template = JST["marker-popup"](properties);
              
              // We use circle markers as we can style them with path CSS.
              var createMarker = function(feature, latlng) {
                var marker = L.circleMarker(latlng);
                marker.bindPopup(template);
                return marker;
              };
              
              var feature = L.geoJson(location.get("location"), {
                pointToLayer: createMarker
              }).addTo(map);
              thing.set("mapFeature", feature);
              map.fitBounds(feature.getBounds());
            }
          });
          
          // Load Datastreams
          Q(thing.getDatastreams({
            data: {
              "$expand": "Sensor,ObservedProperty"
            }
          }))
          .then(function(datastreams) {
            datastreams.forEach(function(datastream) {
              // Draw template for each datastream
              var template = JST["datastream-card"](datastream.attributes);
              var $el = $("#datastreams").append(template);
              
              var sensorTemplate = JST["sensor-info"](datastream.sensor.attributes);
              $el.find(".sensor-attributes").append(sensorTemplate);
              
              var propertyTemplate = JST["observed-property-info"](datastream.observedProperty.attributes);
              $el.find(".observed-property-attributes").append(propertyTemplate);
              
              // Draw an empty chart
              var id = datastream.get("@iot.id");
              var chart = new Chart(`#datastream-${id}-chart`, {
                color: colorForId(id),
                unitOfMeasurement: datastream.get("unitOfMeasurement")
              });
              
              Q(datastream.getObservations())
              .then(function(observations) {
                var values = transformObservations(observations);
                chart.loadData([{ key: datastream.get("description"), values: values }]);
              })
            });
          });
        })
        .done();
      });<commit_msg>Fix templates being included multiple times<commit_after>doctype
html
  head
    meta(charset='utf-8')
    meta(http-equiv='X-UA-Compatible', content='IE=edge')
    title Dashboard
    meta(name='description', content='')
    meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
    link(rel="stylesheet", href="/style.css")

    script(type="text/javascript", src="/templates.js")
    script(type="text/javascript", src="/app.js")

  body
    nav.navbar.navbar-full.navbar-dark.bg-inverse
      button.navbar-toggler.hidden-sm-up(type="button", data-toggle="collapse", data-target="#navbar", aria-expanded="false", aria-controls="navbar")
        span.sr-only Toggle Navigation
        span.icon-bar
        span.icon-bar
        span.icon-bar
      
      a.navbar-brand(href="index.html") LOGO
      
      div#navbar
        nav.nav.navbar-nav.pull-right
          a.nav-item.nav-link(href="map.html") Map
          a.nav-item.nav-link(href="settings.html") Settings

    div#content.container
      div.row.card
        div#thing-info.col-sm-8.card-block
          h1.page-header Loading&hellip;
        
          dl
            dt Description
            dd Loading&hellip;
          
        div#small-map-container.col-sm-4
          div#map
          
      div.row
        div.col-sm-3.card-block
          h4 Time Range
        div.col-sm-9.card-block
          h5.pull-xs-right
            a(href="#")
              time May 1 2016 00:00:00 UTC
              | &nbsp;
              i.fa.fa-calendar
            wbr
            | &nbsp;to&nbsp;
            wbr
            a(href="#")
              time May 2 2016 00:00:00 UTC
              | &nbsp;
              i.fa.fa-calendar            
          
      div#datastreams
          
    script(type="text/javascript").
      $(function() {
        // Update query params in URL, get SensorThings URL from query params
        // or from LocalStorage.
        ParamsController.activate();
        var ST = new SensorThings(ParamsController.get("stURL"));
        
        var Thing = ST.getThing(ParamsController.get("id"), {
          data: {
            "$expand": "Locations"
          }
        });
        
        // Map
        
        L.Icon.Default.imagePath = "/images";
        
        var map = L.map('map', {
          dragging: false,
          touchZoom: false,
          scrollWheelZoom: false,
          doubleClickZoom: false,
          boxZoom: false,
          keyboard: false,
          zoomControl: false
        }).setView([51.049, -114.08], 13);

        L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
        }).addTo(map);
        
        // Data Load Handler
        Q(Thing).then(function(thing) {
          // Load Metadata
          var properties = $.extend({}, thing.attributes, {
            locationDescription: thing.locations[0].get("description")
          });
          var template = JST["thing-info"](properties);
          $("#thing-info").html(template);
          
          // Load feature marker
          Q(thing.locations)
          .then(function(locations) {
            var location = locations[0];
            if (location && location.get("location")) {
              // Generate HTML for popup
              var properties = $.extend({}, thing.attributes, { 
                stURL: encodeURIComponent(ParamsController.get("stURL"))
              });
              var template = JST["marker-popup"](properties);
              
              // We use circle markers as we can style them with path CSS.
              var createMarker = function(feature, latlng) {
                var marker = L.circleMarker(latlng);
                marker.bindPopup(template);
                return marker;
              };
              
              var feature = L.geoJson(location.get("location"), {
                pointToLayer: createMarker
              }).addTo(map);
              thing.set("mapFeature", feature);
              map.fitBounds(feature.getBounds());
            }
          });
          
          // Load Datastreams
          Q(thing.getDatastreams({
            data: {
              "$expand": "Sensor,ObservedProperty"
            }
          }))
          .then(function(datastreams) {
            datastreams.forEach(function(datastream) {
              // Draw template for each datastream
              var $template = $(JST["datastream-card"](datastream.attributes));
              $("#datastreams").append($template);
              
              var sensorTemplate = JST["sensor-info"](datastream.sensor.attributes);
              $template.find(".sensor-attributes").append(sensorTemplate);
              
              var propertyTemplate = JST["observed-property-info"](datastream.observedProperty.attributes);
              $template.find(".observed-property-attributes").append(propertyTemplate);
              
              // Draw an empty chart
              var id = datastream.get("@iot.id");
              var chart = new Chart(`#datastream-${id}-chart`, {
                color: colorForId(id),
                unitOfMeasurement: datastream.get("unitOfMeasurement")
              });
              
              Q(datastream.getObservations())
              .then(function(observations) {
                var values = transformObservations(observations);
                chart.loadData([{ key: datastream.get("description"), values: values }]);
              })
            });
          });
        })
        .done();
      });
{'fraction_non_alphanumeric': 0.12997772828507795, 'fraction_numerical': 0.008017817371937639, 'mean_word_length': 1.5896193771626297, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, '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': '2929889', 'n_tokens_mistral': 3148, 'n_tokens_neox': 3006, 'n_words': 529}