<commit_before>$(document).ready(function() {
  var url = 'https://status.app.dnt.no/api/v1/checks';

  $.getJSON(url).done(status);

  var $panel = $('#panel');
  var $apps = $('#apps');
  var $services = $('#services');

  function status(data) {
    data.checks = data.checks.map(function(check) {
      check.class = check.status === 'up' ? 'operational' : 'major outage';
      check.text = check.status === 'up' ? 'operativ' : 'ute av drift';
      check.category = check.tags.reduce(function(cat, tag) {
        return tag.name === 'service' ? 'service' : cat;
      }, 'app');

      return check;
    });

    var status = data.checks.reduce(function(status, check) {
      return check.status !== 'up' ? 'major outage' : status;
    }, 'operational');

    $panel.attr('class', 'panel ' + status);
    $panel.html(status === 'operational' ? 'Alle systemer er operative.' : 'Ett eller flere systemer ute av drift');
<commit_msg>Show checks with recent outages as unstable<commit_after>$(document).ready(function() {
  var url = 'https://status.app.dnt.no/api/v1/checks';

  $.getJSON(url).done(status);

  var $panel = $('#panel');
  var $apps = $('#apps');
  var $services = $('#services');

  function status(data) {
    data.checks = data.checks.map(function(check) {
      check.class = check.status === 'up' ? 'operational' : 'major outage';
      check.text = check.status === 'up' ? 'operativ' : 'ute av drift';
      check.category = check.tags.reduce(function(cat, tag) {
        return tag.name === 'service' ? 'service' : cat;
      }, 'app');

      // check time since last outage
      if (check.status === 'up' && Date.now() - (check.lasterrortime * 1000) <= 86400000) {
        check.class = 'degraded performance';
        check.text = 'ustabil';
      }

      return check;
    });

    var status = data.checks.reduce(function(status, check) {
      return check.status !== 'up' ? 'major outage' : status;
    }, 'operational');

    $panel.attr('class', 'panel ' + status);
    $panel.html(status === 'operational' ? 'Alle systemer er operative.' : 'Ett eller flere systemer ute av drift');

{'fraction_non_alphanumeric': 0.1885902876001886, 'fraction_numerical': 0.006600660066006601, 'mean_word_length': 3.152641878669276, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2713988', 'n_tokens_mistral': 705, 'n_tokens_neox': 670, 'n_words': 161}