<commit_before>$(function(){
    return $.getJSON('/api/v1/assign_roles/users', function (data) {
      window.users=Object.keys(data)
        .map(n=>{
            return {val:n.split('@')[0]};
        });
    });
});

function generate_category_label(category){
    if (category == 'Workset'){
         category='<span class="label label-primary">'+ category +"</span>";
     }else if (category == 'Flowcell'){
         category='<span class="label label-success">'+ category +"</span>";
     }else if (category == 'Meeting' || category == "Decision"){
         category='<span class="label label-info">'+ category +"</span>";
     }else if (category == 'User Communication'){
         category='<span class="label label-danger">'+ category +"</span>";
     }else if (category == 'Bioinformatics'){
         category='<span class="label label-warning">'+ category +"</span>";
     }else if (category == 'Important'){
         category='<span class="label label-imp">'+ category +"</span>";
     }else if (category == 'Deviation'){
	       category='<span class="label label-devi">'+ category +"</span>";
     }else if (category != ''){
         category='<span class="label label-default">'+ category +"</span>";
     }
     return category;
}
function get_note_url() {
    // URL for the notes
    if ((typeof notetype !== 'undefined' && notetype == 'lims_step') || ('lims_step' in window && lims_step !== null)){
        note_url='/api/v1/workset_notes/' + lims_step;
    } else if ((typeof notetype !== 'undefined' && notetype == 'flowcell') || ('flowcell' in window && flowcell!== null)){
        note_url='/api/v1/flowcell_notes/' + flowcell;
    } else {
        note_url='/api/v1/running_notes/' + project;
    }
    return note_url;
}

function make_running_note(date, note){
  try {
    var category = '';
    var date = date.replace(/-/g, '/');
    date = date.replace(/\.\d{6}/, '');
    date = new Date(date);
    if (note['note'] != undefined){
        if(date > new Date('2015-01-01')){
          noteText = make_markdown(note['note']);
        } else {
          noteText = '<pre class="plaintext_running_note">'+make_project_links(note['note'])+'</pre>';
        }
        datestring = date.toDateString() + ', ' + date.toLocaleTimeString(date);
        note_id = 'running_note_'+project+'_'+(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(),
                   date.getUTCDate(), date.getHours(), date.getMinutes(), date.getSeconds())/1000);
        if ('category' in note){
            category=generate_category_label(note['category']);
        }
    }
  } catch(e){
    noteText = '<pre>'+make_project_links(note['note'])+'</pre>';
    var datestring = '?';
  }
  var printHyphen =category? ' - ': ' ';
  var panelClass='';
  if (note['category'] == 'Important') {
    panelClass = 'panel-important';
  }
  return '<div class="panel panel-default">' +
      '<div class="panel-heading '+panelClass+'" id="'+note_id+'">'+
        '<a href="mailto:' + note['email'] + '">'+note['user']+'</a> - '+
       '<a href="#'+note_id+'">' + datestring + '</a>' + printHyphen +category +'</div><div class="panel-body">'+noteText+'</div></div>';
}

function load_running_notes(wait) {
  // Clear previously loaded notes, if so
  note_url = get_note_url();<commit_msg>Running note if update for flowcell and workset pages<commit_after>$(function(){
    return $.getJSON('/api/v1/assign_roles/users', function (data) {
      window.users=Object.keys(data)
        .map(n=>{
            return {val:n.split('@')[0]};
        });
    });
});

function generate_category_label(category){
    if (category == 'Workset'){
         category='<span class="label label-primary">'+ category +"</span>";
     }else if (category == 'Flowcell'){
         category='<span class="label label-success">'+ category +"</span>";
     }else if (category == 'Meeting' || category == "Decision"){
         category='<span class="label label-info">'+ category +"</span>";
     }else if (category == 'User Communication'){
         category='<span class="label label-danger">'+ category +"</span>";
     }else if (category == 'Bioinformatics'){
         category='<span class="label label-warning">'+ category +"</span>";
     }else if (category == 'Important'){
         category='<span class="label label-imp">'+ category +"</span>";
     }else if (category == 'Deviation'){
	       category='<span class="label label-devi">'+ category +"</span>";
     }else if (category != ''){
         category='<span class="label label-default">'+ category +"</span>";
     }
     return category;
}
function get_note_url() {
    // URL for the notes
    if ((typeof notetype !== 'undefined' && notetype == 'lims_step') || ('lims_step' in window && lims_step !== null)){
        note_url='/api/v1/workset_notes/' + lims_step;
    } else if ((typeof notetype !== 'undefined' && notetype == 'flowcell') || ('flowcell' in window && flowcell!== null)){
        note_url='/api/v1/flowcell_notes/' + flowcell;
    } else {
        note_url='/api/v1/running_notes/' + project;
    }
    return note_url;
}

function make_running_note(date, note){
  try {
    var category = '';
    var date = date.replace(/-/g, '/');
    date = date.replace(/\.\d{6}/, '');
    date = new Date(date);
    if (note['note'] != undefined){
        if(date > new Date('2015-01-01')){
          noteText = make_markdown(note['note']);
        } else {
          noteText = '<pre class="plaintext_running_note">'+make_project_links(note['note'])+'</pre>';
        }
        datestring = date.toDateString() + ', ' + date.toLocaleTimeString(date);
        var page_to_link = '';
        if(typeof project !== 'undefined'){
          page_to_link = project;
        }
        else if (typeof flowcell!== 'undefined') {
          page_to_link = flowcell;
        }
        else if(typeof workset_name !== 'undefined'){
          page_to_link = workset_name
        }
        note_id = 'running_note_'+page_to_link+'_'+(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(),
                   date.getUTCDate(), date.getHours(), date.getMinutes(), date.getSeconds())/1000);
        if ('category' in note){
            category=generate_category_label(note['category']);
        }
    }
  } catch(e){
    noteText = '<pre>'+make_project_links(note['note'])+'</pre>';
    var datestring = '?';
  }
  var printHyphen =category? ' - ': ' ';
  var panelClass='';
  if (note['category'] == 'Important') {
    panelClass = 'panel-important';
  }
  return '<div class="panel panel-default">' +
      '<div class="panel-heading '+panelClass+'" id="'+note_id+'">'+
        '<a href="mailto:' + note['email'] + '">'+note['user']+'</a> - '+
       '<a href="#'+note_id+'">' + datestring + '</a>' + printHyphen +category +'</div><div class="panel-body">'+noteText+'</div></div>';
}

function load_running_notes(wait) {
  // Clear previously loaded notes, if so
  note_url = get_note_url();
{'fraction_non_alphanumeric': 0.20323793003758311, 'fraction_numerical': 0.005203816131830009, 'mean_word_length': 3.1530612244897958, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 67, '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': '3379135', 'n_tokens_mistral': 2231, 'n_tokens_neox': 2180, 'n_words': 447}